From: Christian Herdtweck Date: Tue, 2 Oct 2018 08:35:55 +0000 (+0200) Subject: Fix whitespace in comments in template X-Git-Tag: v1.3~19^2~3 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=a53fd090416e1ad949d2ba75089db3aa63ce8791;p=pyi2ncommon Fix whitespace in comments in template --- diff --git a/templates/test_template.py b/templates/test_template.py index 51d29f1..a1ccc59 100644 --- a/templates/test_template.py +++ b/templates/test_template.py @@ -18,11 +18,12 @@ # # Copyright (c) 2016-2018 Intra2net AG -""" test_module_name.py: unit tests for module_name +""" +test_module_name.py: unit tests for module_name Tests classes and functions in module_name -Should be able run from python2 and python3! +MUST start with test_, otherwise python unittest module will ignore this! For help see :py:mod:`unittest` """ @@ -34,44 +35,48 @@ from src import module_name def setUpModule(): - """ called once before all tests in this module """ + """called once before all tests in this module""" print('setting up test module') def tearDownModule(): - """ called once after all in this module are done """ + """called once after all in this module are done""" print('tearing down test module') class ModuleNameTester(unittest.TestCase): - """ only test case in this module, see module doc for more help """ + """only test case in this module, see module doc for more help""" @classmethod def setUpClass(cls): - """ called once before tests in this class """ + """called once before tests in this class""" print('setting up test class') @classmethod def tearDownClass(cls): - """ called once when all tests in this class are done """ + """called once when all tests in this class are done""" print('tearing down test class') def setUp(self): - """ called before each test function """ + """called before each test function""" print('setup test') def tearDown(self): - """ called after each test function """ + """called after each test function""" print('tear down test') def test_some_func(self): - """ tests some_func """ + """tests some_func""" this_is_implemented = False + self.helper_func() self.assertTrue(this_is_implemented, 'Appears not yet implemented') self.fail('Fail in any case, but with this nice message') + def helper_func(self): + """Helper function, can be used by tests, not run as test itself""" + if __name__ == '__main__': unittest.main()