简体   繁体   中英

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 .

Nevermid, I found:

    self.add_marker('foo')

This works because Item inherits Node which has this method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM