Running tests automatically whenever the source code is compiled is a bad idea. Python advertises itself as an interpreted language where compilation is invisible to the user. Tests often have side effects or take up serious amounts of resources, which would make them far from invisible. (For example, the socket test forks off a process and binds a socket to a port. While this port is not likely to be used by another server, it's not impossible, and one common effect (for me :-) is to find that two test runs interfere with each other. The socket test also takes about 10 seconds to run.) There are lots of situations where compilation occurs during the normal course of events, even for standard modules, and certainly for 3rd party library modules (for which the .pyc files aren't always created at installation time). So, running __test__ at every compilation is a no-no for me. That said, there are sane alternatives: e.g. distutils could run the tests automatically whenever it is asked to either build or install. --Guido van Rossum (home page: http://www.python.org/~guido/)