RuntimeError when using latest master on Django 2.2
stevejalim opened this issue · comments
This may be a false alarm (am investigating here, too), but off the back of #11 I pinned the relevant commit on master
via -e git://github.com/justinmayer/django-elevate.git@f3ca619de2ca51c5754df8497a2e4ac3e098a67b#egg=django-elevate
and now I can't boot pytest:
/usr/local/lib/python3.7/site-packages/_pytest/config/__init__.py:435: in _importconftest
return self._conftestpath2mod[conftestpath]a
E KeyError: local('/usr/src/app/REDACTED/src/django-elevate/conftest.py')
During handling of the above exception, another exception occurred:
/usr/local/lib/python3.7/site-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/usr/local/lib/python3.7/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
/usr/local/lib/python3.7/site-packages/py/_path/common.py:418: in gen
dirs = self.optsort([p for p in entries
/usr/local/lib/python3.7/site-packages/py/_path/common.py:419: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
/usr/local/lib/python3.7/site-packages/_pytest/main.py:660: in _recurse
ihook = self.gethookproxy(dirpath)
/usr/local/lib/python3.7/site-packages/_pytest/main.py:481: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
/usr/local/lib/python3.7/site-packages/_pytest/config/__init__.py:419: in _getconftestmodules
mod = self._importconftest(conftestpath.realpath())
/usr/local/lib/python3.7/site-packages/_pytest/config/__init__.py:469: in _importconftest
self.consider_conftest(mod)
/usr/local/lib/python3.7/site-packages/_pytest/config/__init__.py:519: in consider_conftest
self.register(conftestmodule, name=conftestmodule.__file__)
/usr/local/lib/python3.7/site-packages/_pytest/config/__init__.py:316: in register
ret = super(PytestPluginManager, self).register(plugin, name)
/usr/local/lib/python3.7/site-packages/pluggy/manager.py:102: in register
hook._maybe_apply_history(hookimpl)
/usr/local/lib/python3.7/site-packages/pluggy/hooks.py:336: in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
/usr/local/lib/python3.7/site-packages/pluggy/manager.py:68: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python3.7/site-packages/pluggy/manager.py:62: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
src/django-elevate/conftest.py:41: in pytest_configure
ROOT_URLCONF='tests.urls',
/usr/local/lib/python3.7/site-packages/django/conf/__init__.py:107: in configure
raise RuntimeError('Settings already configured.')
E RuntimeError: Settings already configured.
Python 3.7.3, Django 2.2.
Will keep on poking and will close the ticket with a solution if I work it out
Can you confirm if this is a Django 2.2 issue or a PyTest issue? I.e. does everything work when you downgrade to Django 2.1?
Note - it may be a conflict with pytest-django - I'll take a look when am back at my desk tomorrow (am on UTC) (ref pytest-dev/pytest-django#62)
OK, having read through the stacktrace I have a question: why are you using configtest.py from django-elevate?
@moggers87 I'm not - at least not explicitly. Am just on a package-upgrade ticket and things have started failing. I was thinking just now that I'm going to check out pytest.ini is definitely [still] excluding tests for installed packages
@moggers87 yep - that sorted it. pytest.ini
wasn't set up to exclude the src
dir where any pinned dependencies were cloned to before build and pytest was picking up elevate's conftest.
Apols for the false alarm! 😢