Pytest ImportError没有名为' test'的模块

时间:2017-09-25 16:20:41

标签: python pytest circleci

我正在尝试在CircleCI上运行pytest,本地我没有问题,但是当我执行shell命令时

PYTHONPATH=. pytest --cov-report html:$CIRCLE_ARTIFACTS/htmlcov --nomigrations

我得到以下追溯:

Traceback (most recent call last):
  File "/home/ubuntu/virtualenvs/venv-2.7.12/bin/pytest", line 11, in <module>
    sys.exit(main())
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 49, in main
    config = _prepareconfig(args, plugins)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 168, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
    wrap_controller.send(call_outcome)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result
    _reraise(*ex)  # noqa
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 957, in pytest_cmdline_parse
    self.parse(args)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 1121, in parse
    self._preparse(args, addopts=addopts)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 1092, in _preparse
    args=args, parser=self._parser)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call
    return call_outcome.get_result()
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result
    _reraise(*ex)  # noqa
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/pytest_django/plugin.py", line 244, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/opt/circleci/python/2.7.12/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/pytest_django/plugin.py", line 117, in _handle_import_error
    raise ImportError(msg)
ImportError: No module named test

pytest-django found a Django project in /home/ubuntu/rit-das-pdp (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.

PYTHONPATH=. pytest --cov-report html:$CIRCLE_ARTIFACTS/htmlcov --nomigrations returned exit code 1

我不知道错误说的是什么或如何调试它。

0 个答案:

没有答案