0
我有一個Django項目與setup.py
看起來像這樣:coverage.py和setup.py和Django的測試
.
├── backend
├── backoffice
├── backoffice_set
├── manage.py
├── MANIFEST.in
├── media
├── README.rst
├── requirements.txt
├── setup.py
└── venv2.7
當我運行:python setup.py test
一切正常但是,當我運行:
/opt/bin/coverage run setup.py test
測試失敗:
writing dependency_links to cfe_backoffice.egg-info/dependency_links.txt
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'backoffice/templates/backoffice/'
writing manifest file 'cfe_backoffice.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 21, in <module>
setup(
File "/opt/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/opt/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/opt/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 138, in run
self.with_project_on_sys_path(self.run_tests)
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 118, in with_project_on_sys_path
func()
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line 164, in run_tests
testLoader = cks
File "/opt/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/opt/lib/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/opt/lib/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/opt/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/lib/python2.7/unittest/loader.py", line 100, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'runtests'
有沒有人見過這個?你能提出一個解決方案嗎?