【发布时间】:2016-06-20 17:57:45
【问题描述】:
我正在尝试运行 Django 测试(1.8 版)
但我得到了这个错误
from django.test import TestCase
class JobTypesResourceTest (TestCase):
def setUp(self):
TestCase.setUp(self)
def test_basicGet(self):
return True
Traceback (most recent call last):
File "C:\Users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\runfiles.py", line 234, in <module>
main()
File "C:\Users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\runfiles.py", line 78, in main
return pydev_runfiles.main(configuration) # Note: still doesn't return a proper value.
File "C:\Users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydev_runfiles.py", line 835, in main
PydevTestRunner(configuration).run_tests()
File "C:\Users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydev_runfiles.py", line 793, in run_tests
MyDjangoTestSuiteRunner(run_tests).run_tests([])
File "C:\Users\user\.p2\pool\plugins\org.python.pydev_4.4.0.201510052309\pysrc\pydev_runfiles.py", line 813, in run_tests
raise AssertionError("Unable to run suite with DjangoTestSuiteRunner because it couldn't be imported.")
AssertionError: Unable to run suite with DjangoTestSuiteRunner because it couldn't be imported.
我是否缺少 python 库?
【问题讨论】:
-
您的代码中有错字:不是
true,而是True -
谢谢我已经修好了,所以这不是问题
-
你的测试课对我有用。你有追溯吗?
-
您好,我使用了您在创建新 Django 项目时获得的默认文件层次结构,并且我正在使用 Eclipse run as pyunit 运行
-
看来你应该配置 Pyunit 测试运行器。不过最好不要使用IDE。 :-°
标签: django eclipse pydev django-testing python-unittest