Open windiana42 opened 1 year ago
tests/integration/test_multiple_statements.py:None (tests/integration/test_multiple_statements.py)
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/_pytest/config/__init__.py:1540: in getoption
val = getattr(self.option, name)
E AttributeError: 'Namespace' object has no attribute 'backend'
The above exception was the direct cause of the following exception:
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/_pytest/python.py:272: in pytest_pycollect_makeitem
return list(collector._genfunctions(name, obj))
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/_pytest/python.py:499: in _genfunctions
self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/pluggy/_hooks.py:292: in call_extra
return self(**kwargs)
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
integration/conftest.py:42: in pytest_generate_tests
"backend", [metafunc.config.getoption("backend")], scope="module"
../../../progs/miniconda3/envs/pytsql/lib/python3.10/site-packages/_pytest/config/__init__.py:1551: in getoption
raise ValueError(f"no option named {name!r}") from e
E ValueError: no option named 'backend'
This code snippet in conftest.py seems to be related:
def pytest_generate_tests(metafunc):
if "backend" in metafunc.fixturenames:
metafunc.parametrize(
"backend", [metafunc.config.getoption("backend")], scope="module"
)
proposed solution will be as a commit in issue44 (#44) branch/PR:
def pytest_generate_tests(metafunc):
if "backend" in metafunc.fixturenames:
try:
metafunc.parametrize(
"backend", [metafunc.config.getoption("backend")], scope="module"
)
except ValueError:
# some metafunc.config objects don't have an option "backend"
metafunc.parametrize(
"backend", ["default_backend"], scope="module"
)
This error appeared to me during debugging pytsql, then it vanished, and now it resurfaced:
It could be a problem of my pycharm installation, but this is the first repo where it happens. I checked both python 3.11 and 3.10. I tested pycharm 2022.2.1 and 2022.2.4