Skip to content

PyTest is running app code outside of designated test functions #10716

Discussion options

You must be logged in to vote

You run main on import, pytest must import to find functions

Protect your call to main by checking if __name__ == "__main__" :

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@gh-andre
Comment options

@RonnyPfannschmidt
Comment options

@gh-andre
Comment options

@RonnyPfannschmidt
Comment options

Answer selected by gh-andre
Comment options

You must be logged in to vote
2 replies
@The-Compiler
Comment options

@gh-andre
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants