【发布时间】:2018-03-24 18:37:41
【问题描述】:
我有一组可以成功运行的单元测试:./runtests.py wagtail.wagtailcore.tests
我也可以跑:
./runtests.py wagtail.wagtailcore.tests.test_page_privacy
但如果我只想执行其中一个,我会收到 'module' object has no attribute [test_case_name] 的错误
我的课是这样的:
class TestPagePrivacy(TestCase):
def test_anonymous_user_must_authenticate(self):
所以我想你可以说:./runtests.py wagtail.wagtailcore.tests.test_page_privacy.test_anonymous_user_must_authenticate
为什么这不起作用?
来自 django 文档:
https://docs.djangoproject.com/en/1.11/topics/testing/overview/#running-tests
# Run just one test method
$ ./manage.py test animals.tests.AnimalTestCase.test_animals_can_speak
【问题讨论】:
-
我猜你需要把测试用例类名放在中间
-
抱歉,修改了我的帖子 - 这不起作用。
标签: python django unit-testing python-unittest wagtail