samedi 4 juillet 2020

How do I run a pytest fixture once before all tests in a specific directory?

This is my directory structure:

test_directory/
├── test_feature_1/
│   ├── test1.py
│   └── test2.py
└── test_feature_2/
    ├── test3.py
    └── test4.py

I want to run a fixture function ONCE and then execute each of the tests in test_feature_1 directory. After that, teardown the fixture. I do not want to execute this fixture for other tests in other directories.

Which scope should I use and where should I define my conftest.py? Thanks!

Aucun commentaire:

Enregistrer un commentaire