[pytest-dev] Access markers from pytest_generate_tests?

Nikolaus Rath Nikolaus at rath.org
Fri Nov 28 00:39:17 CET 2014


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...

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the pytest-dev mailing list