Django 1.4说"没有指定数据库夹具.请在命令行中提供至少一个夹具的路径."

Vid*_*dul 6 django unit-testing fixtures

所有测试都完成没有错误,实际加载了固定装置.是Django 1.4问题吗?

请注意,只有部分应用程序会引发此错误消息(应用程序的单元测试与其相应的夹具之间没有概念上的区别).

更新1:fasttest.py内容:

DATABASES = {'default':
  {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': ':memory:',
  }
}

~/django_project$ ./manage.py test appname --traceback --settings=fasttest
Creating test database for alias 'default'...
.....................No database fixture specified. Please provide the path of at least one fixture in the command line.
 .
----------------------------------------------------------------------
Ran 22 tests in 8.426s

OK
Destroying test database for alias 'default'...
Run Code Online (Sandbox Code Playgroud)

更新2:显然评论虽然我感谢尝试,但只是在黑暗中拍摄.数据库没关系,SQLite3和Postgres测试DB都没有解决问题.

小智 7

我在1.4以下的测试装置上遇到了同样的问题.

对我来说,我有一个测试用例,我没有使用灯具,因此我将灯具设置为这样的空集:

class MyTestCase(TestCase):
    fixtures = []
Run Code Online (Sandbox Code Playgroud)

当我注释掉那一行时,错误就消失了:

class MyTestCase(TestCase):
#    fixtures = []
Run Code Online (Sandbox Code Playgroud)