0

我在一个名为 的文件中有一个最小的测试用例testDummy.py,位于/MyApp/MyApp/(与默认值一起settings.py

from django.test import TestCase

class DummyTests(TestCase):

    def setUp(self):
        print("Setup")

    def tearDown(self):
        print("Teardown")

    def test_noddy(self):

        self.assertEqual(1, 2)

执行时manage.py test -v 2,我得到...

Creating test database for alias 'default' ('test_myapp')...
Creating tables ...
Creating table django_content_type
Creating table contenttypes_concretemodel
...
Creating table myapp_login_audit
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
test_get_for_concrete_model (django.contrib.contenttypes.tests.ContentTypesTests) ... ok
...
test_shortcut_view (django.contrib.contenttypes.tests.ContentTypesTests) ... ok
test_shortcut_view_with_broken_get_absolute_url (django.contrib.contenttypes.tes
ts.ContentTypesTests) ... ok
test_shortcut_view_without_get_absolute_url (django.contrib.contenttypes.tests.C
ontentTypesTests) ... ok

----------------------------------------------------------------------
Ran 10 tests in 0.389s

OK
Destroying test database for alias 'default' ('test_myapp')...

但是,它总是运行相同的 10 个测试(没有一个是我的)。如果我这样做manage.py test -v 2 MyApp,它会运行 0 个测试。

我错过了什么?

(Python3、Django 1.6)

4

0 回答 0