mirror of
https://github.com/python/cpython.git
synced 2025-09-29 19:56:59 +00:00
[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 9255104499
)
This commit is contained in:
parent
86f37b5225
commit
fdf151bbfb
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue