pytest_addoption not doing its job
When trying to running pytest in the pygwinc/test directory as
pytest
all of the tests work. When running it from the gwinc directory I get the following error
Error
==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:458: in _importconftest
return self._conftestpath2mod[key]
E KeyError: PosixPath('/home/kevin/Documents/Research/GWdetectionCode/pygwinc/gwinc/test/cache/7bda7f0598e6b78ac90f9d986e105469bbed08d0/gwinc/conftest.py')
During handling of the above exception, another exception occurred:
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:383: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:424: in gen
dirs = self.optsort([p for p in entries
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:425: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
/home/kevin/.local/lib/python3.7/site-packages/_pytest/main.py:622: in _recurse
ihook = self.gethookproxy(dirpath)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/main.py:441: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:436: in _getconftestmodules
mod = self._importconftest(conftestpath)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:483: in _importconftest
self.consider_conftest(mod)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:536: in consider_conftest
self.register(conftestmodule, name=conftestmodule.__file__)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:342: in register
ret = super().register(plugin, name)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/manager.py:127: in register
hook._maybe_apply_history(hookimpl)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/hooks.py:333: in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
gwinc/test/cache/7bda7f0598e6b78ac90f9d986e105469bbed08d0/gwinc/conftest.py:26: in pytest_addoption
help = "Have tests update plots (it is slow)",
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/argparsing.py:78: in addoption
self._anonymous.addoption(*opts, **attrs)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/argparsing.py:314: in addoption
raise ValueError("option names %s already added" % conflict)
E ValueError: option names {'--plot'} already added
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 2.08s ===============================
I think this is a problem in the pytest_addoption
function in conftest.py
This isn't an emergency since pytest watch still works when called in the gwinc directory and all the tests run when called in gwinc/test.