ply
ply copied to clipboard
Guard unittest.main() invocation when test files are imported
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.