On Fri, 21 Sep 2018, at 23:06, Ronny Pfannschmidt wrote:
> 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

Works like a charm, thanks!



--
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«
_______________________________________________
pytest-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to