#
# Copyright (c) 2016-2018 Intra2net AG <info@intra2net.com>
-""" 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`
"""
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()