简体   繁体   中英

Is there a way to get all fixtures names used by some test in pytest?

Sometimes it's hard to understand why some fixture code is executed, while it seems should not. So I'd like to print all fixtures names, which will be resolved for some concrete test by pytest for more detailed analysis, is there such feature in pytest?

is there such feature in pytest?

yes.

I'd like to print all fixtures names, which will be resolved for some concrete test by pytest

you could have a look at the output of these first:

pytest --fixtures          # show fixtures
pytest --fixtures -v       # show fixtures also with leading _
pytest --fixtures-per-test # show fixtures per test

if it was not enough, you might also check these out:

pytest --setup-only
pytest --setup-plan

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