Hi Nikolaus,
On Thu, Nov 27, 2014 at 15:39 -0800, Nikolaus Rath wrote:
> Hello,
>
> Is there a way to access test markers sin the pytest_generate_tests
> hook?
>
> For example:
>
> @pytest.mark.bla
> def test_one():
> # ...
>
> def pytest_generate_tests(metafunc):
> if metafunc_has_bla_mark(metafunc):
> # do something
>
>
> But what do you have to use for metafunc_has_bla_mark? Unfortunately
> metafunc.function does not have a `keywords` attribute...
Right now you probably have to use hasattr(metafunc.function, "somename")
but i agree that adding an API to metafunc is much better. It should
be something like:
metafunc.get_marker(...)
which is similar to the existing:
item.get_marker(...)
which you can use in other hooks and contexts.
best,
holger
_______________________________________________
pytest-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-dev