Skip to content

pytest's tests fail: ValueError: Plugin already registered (module 'tests.conftest') (caused by virtualenv's local symlinks) #102

@blueyed

Description

@blueyed

When trying to run the pytest_django tests, py.test fails/aborts:

E ValueError: Plugin already registered: venv/src/pytest_django/tests/conftest.py=<module 'tests.conftest' from 'venv/src/pytest_django/tests/conftest.py'>

I have even tried it in a basic Docker image to make sure it's nothing specific to my setup.

I am using DJANGO_SETTINGS_MODULE=tests.settings_sqlite and pytest_django master.

Since it worked before, I am really wondering what is wrong here.

I have also tried pytest-dev (-e hg+https://bitbucket.org/hpk42/pytest@177f44412427b5060724fafe0263b35bddd91183#egg=pytest-dev).

% bin/py.test
========================================================================== test session starts ===========================================================================
platform linux2 -- Python 2.7.5 -- py-1.4.20 -- pytest-2.6.0.dev1
plugins: django, xdist
collected 0 items / 1 errors 

================================================================================= ERRORS =================================================================================
___________________________________________________________________________ ERROR collecting . ___________________________________________________________________________
local/lib/python2.7/site-packages/py/_path/common.py:327: in visit
>       for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
local/lib/python2.7/site-packages/py/_path/common.py:373: in gen
>               for p in self.gen(subdir):
local/lib/python2.7/site-packages/py/_path/common.py:363: in gen
>                   if p.check(dir=1) and (rec is None or rec(p))])
…/pytest/_pytest/main.py:620: in _recurse
>       ihook.pytest_collect_directory(path=path, parent=self)
…/pytest/_pytest/main.py:162: in call_matching_hooks
>       plugins = self.config._getmatchingplugins(self.fspath)
…/pytest/_pytest/config.py:680: in _getmatchingplugins
>       plugins += self._conftest.getconftestmodules(fspath)
…/pytest/_pytest/config.py:513: in getconftestmodules
>                   mod = self.importconftest(conftestpath)
…/pytest/_pytest/config.py:546: in importconftest
>               self._onimport(mod)
…/pytest/_pytest/config.py:666: in _onimportconftest
>       self.pluginmanager.consider_conftest(conftestmodule)
…/pytest/_pytest/core.py:199: in consider_conftest
>       if self.register(conftestmodule, name=conftestmodule.__file__):
…/pytest/_pytest/core.py:94: in register
>                             name, plugin, self._name2plugin))
E           ValueError: Plugin already registered: venv/src/pytest_django/tests/conftest.py=<module 'tests.conftest' from 'venv/src/pytest_django/tests/conftest.py'>
E           {'helpconfig': <module '_pytest.helpconfig' from '…/pytest/_pytest/helpconfig.pyc'>, 'pytestconfig': <_pytest.config.Config object at 0x2af56c1c6b90>, 'runner': <module '_pytest.runner' from '…/pytest/_pytest/runner.pyc'>, 'unittest': <module '_pytest.unittest' from '…/pytest/_pytest/unittest.pyc'>, 'xdist': <module 'xdist.plugin' from 'venv/src/pytest_django/local/lib/python2.7/site-packages/xdist/plugin.pyc'>, 'pastebin': <module '_pytest.pastebin' from '…/pytest/_pytest/pastebin.pyc'>, 'skipping': <module '_pytest.skipping' from '…/pytest/_pytest/skipping.pyc'>, 'genscript': <module '_pytest.genscript' from '…/pytest/_pytest/genscript.pyc'>, 'session': <Session 'pytest_django'>, 'tmpdir': <module '_pytest.tmpdir' from '…/pytest/_pytest/tmpdir.pyc'>, 'capture': <module '_pytest.capture' from '…/pytest/_pytest/capture.pyc'>, 'terminalreporter': <_pytest.terminal.TerminalReporter instance at 0x24beb90>, 'assertion': <module '_pytest.assertion' from '…/pytest/_pytest/assertion/__init__.pyc'>, 'mark': <module '_pytest.mark' from '…/pytest/_pytest/mark.pyc'>, 'terminal': <module '_pytest.terminal' from '…/pytest/_pytest/terminal.pyc'>, 'main': <module '_pytest.main' from '…/pytest/_pytest/main.pyc'>, 'nose': <module '_pytest.nose' from '…/pytest/_pytest/nose.pyc'>, '47233542048400': <_pytest.config.PytestPluginManager object at 0x2af56a7eca90>, 'python': <module '_pytest.python' from '…/pytest/_pytest/python.pyc'>, 'recwarn': <module '_pytest.recwarn' from '…/pytest/_pytest/recwarn.pyc'>, 'funcmanage': <_pytest.python.FixtureManager instance at 0x2350c68>, 'monkeypatch': <module '_pytest.monkeypatch' from '…/pytest/_pytest/monkeypatch.pyc'>, 'venv/src/pytest_django/tests/conftest.py': <module 'tests.conftest' from 'venv/src/pytest_django/tests/conftest.py'>, 'resultlog': <module '_pytest.resultlog' from '…/pytest/_pytest/resultlog.pyc'>, 'capturemanager': <_pytest.capture.CaptureManager instance at 0x1d314d0>, 'django': <module 'pytest_django.plugin' from 'venv/src/pytest_django/pytest_django/plugin.pyc'>, 'junitxml': <module '_pytest.junitxml' from '…/pytest/_pytest/junitxml.pyc'>, 'doctest': <module '_pytest.doctest' from '…/pytest/_pytest/doctest.pyc'>, 'pytester': <module '_pytest.pytester' from '…/pytest/_pytest/pytester.pyc'>, 'pdb': <module '_pytest.pdb' from '…/pytest/_pytest/pdb.pyc'>}
======================================================================== 1 error in 0.12 seconds =========================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions