Pytest: --strict fails with a marker defined in imported module installed system-wide

Created on 29 Dec 2018  路  2Comments  路  Source: pytest-dev/pytest

$ pip install cupy
$ cat tests/test_marker.py
import pytest, cupy
pytest --strict tests/test_marker.py
______ ERROR collecting tests/test_marker.py ___________
'cudnn' not a registered marker

it comes from https://github.com/cupy/cupy/blob/master/cupy/testing/attr.py#L31

cudnn = pytest.mark.cudnn

I tried to add the files/folders defining it to collect_ignore and norecursedirs, to no avail.

We have no control over cupy and currently are unable to use --strict because of it.

The only workaround I found working is adding to config.cfg's pytest section:

markers =
    cudnn: cupy's marker, ignore it

pytest-4.0.2 here.

Thank you.

Most helpful comment

Unfortunately for you thats per design and a bug in cupy not pytest

We plan to make strict the default in future

Cupy should declare a pytest plugin that uses addinilines to declare the marker

All 2 comments

Unfortunately for you thats per design and a bug in cupy not pytest

We plan to make strict the default in future

Cupy should declare a pytest plugin that uses addinilines to declare the marker

Thank you, @RonnyPfannschmidt. I filed a bug report with cupy: https://github.com/cupy/cupy/issues/1917

Was this page helpful?
0 / 5 - 0 ratings