PEP 299 and unit testing
steven.bethard at gmail.com
Mon Oct 29 04:20:33 CET 2007
Ben Finney wrote:
> What it doesn't allow is for the testing of the 'if __name__ ==
> "__main__":' clause itself. No matter how simple we make that, it's
> still functional code that can contain errors, be they obvious or
> subtle; yet it's code that *can't* be touched by the unit test (by
> design, it doesn't execute when the module is imported), leading to
> errors that won't be caught as early or easily as they might.
You could always use runpy.run_module.
More information about the Python-list