sorin
sorin

Reputation: 170698

How to I dynamically add a pytest marker with my own pytest classes?

I want to add some manual markers to the discovered tests I am doing at https://github.com/pycontribs/pytest-molecule/blob/master/pytest_molecule/init.py#L53

Mainly I want to conditionally add the "foo" mark so some of the discovered tests but I was not able to find any documentation on how to do it with classes based on pytest.Item .

Upvotes: 4

Views: 2903

Answers (1)

sorin
sorin

Reputation: 170698

Nevermid, I found:

    self.add_marker('foo')

This works because Item inherits Node which has this method.

Upvotes: 4

Related Questions