I am new to pytest. I have 10 test files which has multiple tests defined in each test file like below
test_repo
- features
-step_defs
- stress_tests
-file1 (10 test cases)
-file2 (3 test cases)
- functional_tests
- file2 (2 test cases)
- file3 (20 test cases)
and so on.
My problem statement is - when i initiate stress tests i want to setup and tear down like below
- setup testdb
- run stress tests file 1 and file2 on testdb
- tear down delete testdb after all tests are run.
So i want to setup creation and deletion of DB only once and run all 13 test cases from stress_tests.
I tried pytest_fixtures(scope="session") they get reused or called upon each test cases.
Is there a way where i can call the creation of db and dleetion of db only once after all tests run completed?