Am Freitag, den 21.09.2018, 12:44 +0100 schrieb Nikolaus Rath: > Hello, > > I am currently using code like this: > > def pytest_generate_tests(metafunc, _info_cache=[]): > # [...] > > fn = metafunc.function > > do_something(fn.with_backend.kwargs) > for spec in fn.with_backend.args: > # [...] > > This has started to emit a warning: > > /home/nikratio/in-progress/s3ql/tests/t1_backends.py:118: > RemovedInPytest4Warning: MarkInfo objects are deprecated as they > contain merged marks which are hard to deal with correctly. > Please use node.get_closest_marker(name) or node.iter_markers(name). > Docs: https://docs.pytest.org/en/latest/mark.html#updating-code > for spec in fn.with_backend.args: > > > In my case, the correction solution seems to be to use the > get_closest_marker() method instead. However, this is defined for > Node - > neither the metafunc nor the metafunc.function objects have such a > method. > > What's the recommended way to access markers in > pytest_generate_tests?
metafunc.definition.get_closest_marker(...) should do -- Ronny > > Best, > -Nikolaus > > _______________________________________________ pytest-dev mailing list pytest-dev@python.org https://mail.python.org/mailman/listinfo/pytest-dev