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

Get marker list of an item #1603

Closed
fontealpina opened this issue Jun 10, 2016 · 2 comments
Closed

Get marker list of an item #1603

fontealpina opened this issue Jun 10, 2016 · 2 comments

Comments

@fontealpina
Copy link

Is there a way to get the list of markers assigned to an item?
I know that is possible to check it by marker name, like:

def pytest_runtest_setup(item):
    g = item.get_marker("foo")

in this case I have to know the name "foo",
but what if I want to get the list of all the markers of the item?
Thanks

@RonnyPfannschmidt
Copy link
Member

all non-boolean elements in item.keywords

@fontealpina
Copy link
Author

right, it works with something like:

def pytest_runtest_setup(item):
   for i in list(item.keywords):        
       if not item.keywords[i] in [True, False]:
           print i

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants