diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-10-13 03:54:32 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2017-10-13 03:54:32 (GMT) |
commit | fdf151bbfbd5aed7c860ff212faf711a270544f3 (patch) | |
tree | 48e6ecb6967572bca4b686855742d2bdaeb8ce51 /Doc/library | |
parent | 86f37b5225f992e466b1d2a7d0a05ceea6ea5450 (diff) | |
download | cpython-fdf151bbfbd5aed7c860ff212faf711a270544f3.zip cpython-fdf151bbfbd5aed7c860ff212faf711a270544f3.tar.gz cpython-fdf151bbfbd5aed7c860ff212faf711a270544f3.tar.bz2 |
[3.6] 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
(cherry picked from commit 925510449984399cf58711843ddfe2e8007c3878)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/unittest.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 2099bd1..e52f140 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -402,10 +402,14 @@ you can do it yourself:: def suite(): suite = unittest.TestSuite() - suite.addTest(WidgetTestCase('test_default_size')) - suite.addTest(WidgetTestCase('test_resize')) + suite.addTest(WidgetTestCase('test_default_widget_size')) + suite.addTest(WidgetTestCase('test_widget_resize')) 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 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 |