Skip to content

Commit fdf151b

Browse files
miss-islingtonberkerpeksag
authored andcommitted
[3.6] Improve test suite customization example (pythonGH-3967)
Reported by John Gamboa on docs@p.o at https://mail.python.org/pipermail/docs/2017-June/031942.html (cherry picked from commit 9255104)
1 parent 86f37b5 commit fdf151b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎Doc/library/unittest.rst‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,14 @@ you can do it yourself::
402402

403403
def suite():
404404
suite = unittest.TestSuite()
405-
suite.addTest(WidgetTestCase('test_default_size'))
406-
suite.addTest(WidgetTestCase('test_resize'))
405+
suite.addTest(WidgetTestCase('test_default_widget_size'))
406+
suite.addTest(WidgetTestCase('test_widget_resize'))
407407
return suite
408408

409+
if __name__ == '__main__':
410+
runner = unittest.TextTestRunner()
411+
runner.run(suite())
412+
409413
You can place the definitions of test cases and test suites in the same modules
410414
as the code they are to test (such as :file:`widget.py`), but there are several
411415
advantages to placing the test code in a separate module, such as

0 commit comments

Comments
 (0)