Skip to content

Why pytest collect and run my cases twice when Im not using the if __name__ == '__main__' expression #12940

Answered by RonnyPfannschmidt
TapH3ro asked this question in Q&A
Discussion options

You must be logged in to vote

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

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TapH3ro
Comment options

@RonnyPfannschmidt
Comment options

Answer selected by TapH3ro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants