Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pv opened this issue May 26, 2018 · 8 comments
Labels
topic: marks related to marks, either the general marks or builtin type: enhancement new feature or API change, should be merged into features branch

Comments

@pv
Copy link
Contributor

pv commented May 26, 2018

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

@pytestbot pytestbot added the type: bug problem that needs to be addressed label May 26, 2018
@pytestbot
Copy link
Contributor

GitMate.io thinks possibly related issues are #3170 ([pytest 3.4.0] 'NoneType' object has no attribute 'testscollected'), #3050 (deprecate pytest.config), #1882 (pytest 3.0 on Anaconda), #2984 (pytest 3.3: TerminalReporter.writer removed without deprecating it first), and #1965 (Pytest 3.0.2 memory leak with pytest.raises).

@RonnyPfannschmidt RonnyPfannschmidt added the topic: marks related to marks, either the general marks or builtin label May 27, 2018
@RonnyPfannschmidt
Copy link
Member

it seems that a markinfo object was forced into the metadata at a unexpected place

it doesnt happen from pytest alone, i will investigat where it is from

@RonnyPfannschmidt
Copy link
Member

the cases_64bit will set up broken marker objects

@RonnyPfannschmidt
Copy link
Member

i got a fix

@RonnyPfannschmidt
Copy link
Member

i submitted scipy/scipy#8871 to sort it out in scipy
we will still need better errors

@RonnyPfannschmidt RonnyPfannschmidt added type: enhancement new feature or API change, should be merged into features branch and removed type: bug problem that needs to be addressed labels May 27, 2018
@RonnyPfannschmidt RonnyPfannschmidt changed the title pytest 3.6.0 "MarkInfo objects are deprecated ..." internalerror with -Werror accidentially passing MarkInfo objects into internals creates hard to comprehend error May 27, 2018
@RonnyPfannschmidt
Copy link
Member

pytest should trigger warnings and sort out the issue internally when markinfo objects are passed

@pv
Copy link
Contributor Author

pv commented May 27, 2018

Right, indeed the scipy code associated with that test is mucking with the pytest internals.

@RonnyPfannschmidt
Copy link
Member

@nicoddemus i beleive this one has not been sorted out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: marks related to marks, either the general marks or builtin type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

4 participants