Skip to content

accidentially passing MarkInfo objects into internals creates hard to comprehend error #3515

@pv

Description

@pv

Upgrading pytest from 3.5.1 to 3.6.0 for scipy test suite brought up some test failures. An INTERNALERROR appears in the middle of the test run, when running some tests (that use pytest.mark), apparently related to a deprecation message emitted "_pytest.deprecated.RemovedInPytest4Warning: MarkInfo objects are deprecated". The test suite is run with filterwarnings = error enabled, which causes the apparently internally emitted deprecation message to result to an internal error.

Reproducible with

python3 -mpytest --pyarg scipy.sparse.tests.test_base::Test64Bit::test_resiliency_limit_10 -W error
$ ./bin/python3 -mpytest --pyarg scipy.sparse.tests.test_base::Test64Bit::test_resiliency_limit_10 -W error|cat
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/pauli/tmp/xxx, inifile:
collected 964 items

lib64/python3.6/site-packages/scipy/sparse/tests/test_base.py ........ss [  1%]
.............s.....s...ssssssssssssssss.....sss.ss.....s
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/main.py", line 107, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/main.py", line 145, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/__init__.py", line 617, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/__init__.py", line 222, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/__init__.py", line 216, in <lambda>
INTERNALERROR>     firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/callers.py", line 201, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/main.py", line 168, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/__init__.py", line 617, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/__init__.py", line 222, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/__init__.py", line 216, in <lambda>
INTERNALERROR>     firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/callers.py", line 201, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/pluggy/callers.py", line 175, in _multicall
INTERNALERROR>     next(gen)   # first yield
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/warnings.py", line 94, in pytest_runtest_protocol
INTERNALERROR>     with catch_warnings_for_item(item):
INTERNALERROR>   File "/usr/lib64/python3.6/contextlib.py", line 81, in __enter__
INTERNALERROR>     return next(self.gen)
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/warnings.py", line 63, in catch_warnings_for_item
INTERNALERROR>     for mark in item.iter_markers(name='filterwarnings'):
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/nodes.py", line 192, in <genexpr>
INTERNALERROR>     return (x[1] for x in self.iter_markers_with_node(name=name))
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/nodes.py", line 203, in iter_markers_with_node
INTERNALERROR>     if name is None or getattr(mark, 'name', None) == name:
INTERNALERROR>   File "/home/pauli/tmp/xxx/lib64/python3.6/site-packages/_pytest/mark/structures.py", line 20, in warned
INTERNALERROR>     warnings.warn(warning, stacklevel=2)
INTERNALERROR> _pytest.deprecated.RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.
INTERNALERROR> Please use node.get_closest_marker(name) or node.iter_markers(name).
INTERNALERROR> Docs: https://docs.pytest.org/en/latest/mark.html#updating-code

==================== 40 passed, 26 skipped in 1.96 seconds =====================
$ ./bin/pip list
atomicwrites (1.1.5)
attrs (18.1.0)
more-itertools (4.2.0)
numpy (1.14.3)
pip (9.0.3)
pluggy (0.6.0)
py (1.5.3)
pytest (3.6.0)
scipy (1.1.0)
setuptools (39.2.0)
six (1.11.0)

Linux/Fedora 28

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: marksrelated to marks, either the general marks or builtintype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions