pytest crash - 'Config' object has no attribute 'warn'
VERSIONS
- Ubuntu 18.04
- miniconda3 - conda 4.6.1
$ cat pytest.ini
[pytest]
log_format = %(asctime)s - %(name)-12s - %(levelname)-8s - %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
# https://docs.pytest.org/en/latest/warnings.html#deprecationwarning-and-pendingdeprecationwarning
filterwarnings =
ignore:.*Using or importing the ABCs.*:DeprecationWarning
$ pytest --version
This is pytest version 4.2.0, imported from /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest.py
setuptools registered plugins:
pytest-xdist-1.26.1 at /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/xdist/plugin.py
pytest-xdist-1.26.1 at /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/xdist/looponfail.py
pytest-mock-1.10.0 at /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_mock.py
pytest-forked-1.0.1 at /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_forked/__init__.py
pytest-datadir-1.3.0 at /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_datadir/plugin.py
pytest-cov-2.6.1 at /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_cov/plugin.py
pytest-benchmark-3.0.0 at /HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_benchmark/plugin.py
ERROR
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/_pytest/main.py", line 199, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/_pytest/config/__init__.py", line 636, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pluggy/hooks.py", line 306, in call_historic
INTERNALERROR> res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pluggy/manager.py", line 68, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pluggy/manager.py", line 62, in <lambda>
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_benchmark/plugin.py", line 1092, in pytest_configure
INTERNALERROR> config._benchmarksession = BenchmarkSession(config)
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_benchmark/plugin.py", line 568, in __init__
INTERNALERROR> self.logger = Logger(self.verbose, config)
INTERNALERROR> File "/HOME/miniconda3/envs/gis-dataprocessing/lib/python3.6/site-packages/pytest_benchmark/plugin.py", line 519, in __init__
INTERNALERROR> self.pytest_warn = config.warn
INTERNALERROR> AttributeError: 'Config' object has no attribute 'warn'
I suppose you're using this: https://anaconda.org/conda-forge/pytest-benchmark? It would appear they pin an older pytest-benchmark release.
I suppose this is the source https://github.com/conda-forge/pytest-benchmark-feedstock?
Hmmm, might be another case of conda vs. pip inconsistencies. Using a pip install after creating/activating a conda env seemed to solve the problem. Close at will.
I created https://github.com/conda-forge/pytest-benchmark-feedstock/issues/6 for the conda-forge package. I think this issue can be closed.
Facing the same error here.
@TejasAvinashShetty pip install the latest or use whatever was suggested above?
Just to add to this, it still seems to be an issue since today I got the exact same error when I installed the same conda-forge pytest packages as OP.
Versions:
- macOS Mojave 10.14.5 (18F203)
- miniconda3 - conda 4.7.5
- pytest 5.0.1
- pytest-xdist-1.29.0
- pytest-forked-1.0.2
- pytest-datadir-1.3.0
- pytest-voluptuous-1.1.0
- pytest-benchmark-3.2.2
- pytest-cov-2.7.1
- pytest-mock-1.10.4
I have the list of packages in a plaintext file pytest_reqs.txt:
pytest
pytest-benchmark
pytest-cov
pytest-datadir
pytest-forked
pytest-mock
pytest-runner
pytest-xdist
Got the error after installing with:
conda install -c conda-forge --file pytest_reqs.txt
Fixed it with:
conda uninstall -y pytest
pip install -r pytest_reqs.txt
Edit: using python version 3.7.3
@TejasAvinashShetty pip install the latest or use whatever was suggested above?
Yes it works
there is a PR in progress https://github.com/conda-forge/pytest-benchmark-feedstock/pull/7