created test subdir with unit test template
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 3 Dec 2015 15:23:30 +0000 (16:23 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 3 Dec 2015 15:23:30 +0000 (16:23 +0100)
test/template.py [new file with mode: 0644]

diff --git a/test/template.py b/test/template.py
new file mode 100644 (file)
index 0000000..75f889f
--- /dev/null
@@ -0,0 +1,57 @@
+""" module_name_unittest.py: unit tests for module_name
+
+Tests classes and functions in module_name
+
+Should be run from python2 and python3!
+
+For help see :py:mod:`unittest`
+
+.. codeauthor:: your name, your.name@intra2net.com
+"""
+
+import unittest
+
+import module_name
+
+
+def setUpModule():
+    """ called once before all tests in this module """
+    print('setting up test module')
+
+
+def tearDownModule():
+    """ called once after all in this module are done """
+    print('tearing down test module')
+
+
+class ModuleNameTester(unittest.TestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        """ 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 """
+        print('tearing down test class')
+
+    def setUp(self):
+        """ called before each test function """
+        print('setup test')
+
+    def tearDown(self):
+        """ called after each test function """
+        print('tear down test')
+
+    def test_some_func(self):
+        """ tests some_func """
+
+        this_is_implemented = False
+        self.assertTrue(this_is_implemented, 'Appears not yet implemented')
+
+        self.fail('Fail in any case, but with this nice message')
+
+
+if __name__ == '__main__':
+    unittest.main()