我在Travis-CI容器上运行我的测试,但测试似乎失败了以下输出
The command "flake8" exited with 0.
0.39s$ py.test --cov
Traceback (most recent call last):
File "/home/travis/virtualenv/python2.7.11/bin/py.test", line 11, in <module>
sys.exit(main())
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/config.py", line 47, in main
config = _prepareconfig(args, plugins)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/config.py", line 132, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 595, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 249, in _wrapped_call
wrap_controller.send(call_outcome)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/helpconfig.py", line 32, in pytest_cmdline_parse
config = outcome.get_result()
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
_reraise(*ex) # noqa
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 264, in __init__
self.result = func()
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
res = hook_impl.function(*args)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/config.py", line 880, in pytest_cmdline_parse
self.parse(args)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/config.py", line 1030, in parse
self._preparse(args, addopts=addopts)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/config.py", line 1001, in _preparse
args=args, parser=self._parser)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 595, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 253, in _wrapped_call
return call_outcome.get_result()
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
_reraise(*ex) # noqa
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 264, in __init__
self.result = func()
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
res = hook_impl.function(*args)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/pytest_django/plugin.py", line 244, in pytest_load_initial_conftests
dj_settings.DATABASES
File "/opt/python/2.7.11/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/home/travis/virtualenv/python2.7.11/lib/python2.7/site-packages/pytest_django/plugin.py", line 117, in _handle_import_error
raise ImportError(msg)
ImportError: No module named common
pytest-django found a Django project in /home/travis/build/corsecotech/corseco-dashboard-web (it contains manage.py) and added it to the Python path.
If this is wrong, add "django_find_project = false" to pytest.ini and explicitly manage your Python path.
The command "py.test --cov" exited with 1.
Done. Your build exited with 1.
任何人都可以帮我纠正这个错误。在早期的构建中,我没有遇到此错误。只是py.test --cov
命令似乎遇到了麻烦。
TIA
答案 0 :(得分:0)
好。这很简单!由于两个开发人员正在研究这个问题,我只是注意到缺少了导致此错误的settings / common.py文件。哈哈!虽然有趣。
我想我现在需要睡个好觉。
P.s Fixing common.py
解决了这个问题。