-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run a piece of code only one time before all tests run ? #3709
Comments
hi @david-fliguer-ws , due to lack of a use-case I'm going to presume that an autouse session scoped fixture is sufficient there is more than just that to run code before tests, but in order to give more to the point advise we need to know what you are setting out to do instead of how you think it should be done -- Ronny |
@david-fliguer-ws hope the above comment helped you resolve this! If not please comment here and we can reopen / provide more direction :) |
As a walk-around, code inside |
It will also execute if no test runs, which may be a problem |
Hi,
I use pytest as my testing framework.
I would like some piece of code to run only one time before the tests start to run, I would like this also to work even if I run only some of the tests (For example using the -k parameter on the command line)
Where is the recommendation to write that code ? Use fixtures or traditional JUnit style ? Can someone explain more about this topic ?
Thanks a lot !!!
David
The text was updated successfully, but these errors were encountered: