Message189290
Tests have at least two very different purposes. One is test-driven development of code (and tests) by developers. The other is regression detection by buildbots. "if __name__" in code modules, in addition to test modules, makes the first much easier. First, the unittest.main call in the test module must be appropriate for the buildbots. Since buildbots do not execute the corresponding call in the code module, it can and and should tuned for development, which I have done. The 'if' block is also a place for any other code specific to developer tests, such as enabling a 'humanneeded' resource. Second, when editing with Idle, F5 in an editor window runs the test in the Idle shell, where right-click, click on a traceback line takes one back to the corresponding file and line. At least on Windows, using the console and console interpreter is painful by comparison. All this is true when editing any Python file, not just Idle files, so I would be disappointed if someone went through the stdlib deleting, rather than revising the 'if __name__' blocks. |
|
Date |
User |
Action |
Args |
2013-05-15 18:06:57 | terry.reedy | set | recipients:
+ terry.reedy, ncoghlan, ned.deily, ezio.melotti, roger.serwy, r.david.murray, Todd.Rovito, tshepang, francismb, JayKrish, Tomoki.Imai |
2013-05-15 18:06:57 | terry.reedy | set | messageid: <1368641217.02.0.828186620622.issue15392@psf.upfronthosting.co.za> |
2013-05-15 18:06:57 | terry.reedy | link | issue15392 messages |
2013-05-15 18:06:56 | terry.reedy | create | |
|