我知道如何使用django运行特定的测试类:python manage.py test MyApp.MyTestClass.
我想要做的是相反的:除了特别是一个测试之外,每个测试都要运行.在我看来,这看起来像这样:python manage.py test --ignore=MyApp.MyTestClass
有一个简单的方法吗?
编辑:额外的奖励是仍然能够手动运行测试(使用第一个命令).
小智 17
该test命令没有内置的忽略选项.
但是你可以在你想要排除的类中使用@skipor @skipIfdecorator:http://docs.python.org/2.7/library/unittest.html#unittest.skipIf
import unittest
@unittest.skip("skip the test")
class MyTestClass(TestCase):
...
Run Code Online (Sandbox Code Playgroud)