[Python-Dev] "if __name__ == '__main__'" at the bottom of python unittest files

Serhiy Storchaka storchaka at gmail.com
Wed May 1 08:39:15 EDT 2019

01.05.19 10:09, Chris Withers пише:
> Right, but that's not the documented way of running individual suites in 
> the devguide.
> I'm happy to remove these on the basis that there should be one and only 
> one way of doing things like this.

This principle is not applicable here because the Python testsuite is 
not a public API. It is not for use of Python users.

We try to support several different ways of running tests. This allows 
to catch some environment depended flaws in tests and serves as a kind 
of the test of unittest itself. Not all test files are made discoverable 
yet, but we move in this direction.

I do not see what is wrong here and suggest to not break working code.

More information about the Python-Dev mailing list