Skip to content
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

Guard unittest.main() invocation when test files are imported #308

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

echoix
Copy link

@echoix echoix commented Oct 6, 2024

This PR simply adds a if __name__ == "__main__": guard to the unittest.main() call at the end of the two test files, tests/testlex.py and tests/testyacc.py.

This change happens to follow the pattern of the basic example in unittest's docs: https://docs.python.org/3/library/unittest.html#basic-example

With this, this allows to run the test suite normally with the included makefile, as well as with pytest, that can run unittest tests without any changes.

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

Successfully merging this pull request may close these issues.

1 participant