How to run a single test or single TestCase with d

2019-01-26 02:43发布

With Django's normal test runner, you can drill down to run tests in a specific app, a specific subclass of TestCase, or a specific test within a specific subclass of TestCase.

E.g.:

./manage.py test myapp.MyTestCase.test_something

However, django-nose doesn't appear to support anything beyond testing a specific app. How do I replicate the last two behaviors?

2条回答
我命由我不由天
2楼-- · 2019-01-26 03:23

The correct answer is ./manage.py test myapp/tests/test_script:MyTestCase.test_method.

Using dots in the relative path did not work for me, but slashes did.

查看更多
劫难
3楼-- · 2019-01-26 03:31

Nose supports the following syntax (note : between test script name and test class name):

./manage.py test myapp.tests.test_script:MyTestCase.test_method
查看更多
登录 后发表回答