Commit 92551044 authored by Berker Peksag's avatar Berker Peksag Committed by GitHub

Improve test suite customization example (GH-3967)

Reported by John Gamboa on docs@p.o at
https://mail.python.org/pipermail/docs/2017-June/031942.html
parent 6129250b
...@@ -402,10 +402,14 @@ you can do it yourself:: ...@@ -402,10 +402,14 @@ you can do it yourself::
def suite(): def suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(WidgetTestCase('test_default_size')) suite.addTest(WidgetTestCase('test_default_widget_size'))
suite.addTest(WidgetTestCase('test_resize')) suite.addTest(WidgetTestCase('test_widget_resize'))
return suite return suite
if __name__ == '__main__':
runner = unittest.TextTestRunner()
runner.run(suite())
You can place the definitions of test cases and test suites in the same modules You can place the definitions of test cases and test suites in the same modules
as the code they are to test (such as :file:`widget.py`), but there are several as the code they are to test (such as :file:`widget.py`), but there are several
advantages to placing the test code in a separate module, such as advantages to placing the test code in a separate module, such as
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment