Why pytest collect and run my cases twice when Im not using the if __name__ == '__main__' expression #12940
-
sorry for my poor English... python version: 3.10.11 test_demo.py
start_test.py
when i run the start_test.py, it gives me this:
however when i added the if name == 'main' expression
|
Beta Was this translation helpful? Give feedback.
Answered by
RonnyPfannschmidt
Nov 5, 2024
Replies: 1 comment 2 replies
-
The start script has a filename that is searched for tests Searching tests is done after import It's strongly recommended to keep all scripts importable without triggering a execution |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
TapH3ro
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The start script has a filename that is searched for tests
Searching tests is done after import
It's strongly recommended to keep all scripts importable without triggering a execution