蟒蛇单元测试我有一组的单元测试,我可以成功地运行:./runtests.py wagtail.wagtailcore.tests
运行特定测试用例在Django
我还可以运行:
./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
我想你需要把测试用例类名称放在 – georgexsh
之间012对不起,我的帖子赞扬 - 这是行不通的。 – mheavers