summaryrefslogtreecommitdiff
path: root/tests/chrysacase.py
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-11-25 23:26:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-11-25 23:26:53 (GMT)
commit545d0490f6fbb397da66410f534670c52bfcc5da (patch)
treeb6923de79a4b406e51b906b76a737d93ea74b73c /tests/chrysacase.py
parent355a7140932b77d351bc6ddd965608b0011af855 (diff)
Implemented restricted contents and created test cases.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@608 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'tests/chrysacase.py')
-rw-r--r--tests/chrysacase.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/chrysacase.py b/tests/chrysacase.py
new file mode 100644
index 0000000..26625e7
--- /dev/null
+++ b/tests/chrysacase.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python3-dbg
+# -*- coding: utf-8 -*-
+
+
+import unittest
+import os
+import sys
+
+
+class ChrysalideTestCase(unittest.TestCase):
+ """Base class for all Chrysalide test cases."""
+
+ @classmethod
+ def setUpClass(cls):
+
+ fullname = sys.modules[ChrysalideTestCase.__module__].__file__
+ filename = os.path.basename(fullname)
+
+ cls._baselen = len(fullname) - len(filename)
+
+
+ def shortDescription(self):
+ """Discard the direct use of __doc__ strings."""
+
+ return None
+
+
+ def __str__(self):
+ """Display the description of the current tested case."""
+
+ fullname = sys.modules[self.__class__.__module__].__file__
+
+ origin = fullname[self._baselen:]
+
+ title = self._testMethodDoc and self._testMethodDoc or self._testMethodName
+
+ return '[%s] "%s"' % (origin, title)
+
+
+ @classmethod
+ def log(cls, msg):
+ """Display an information message."""
+
+ fullname = sys.modules[cls.__module__].__file__
+
+ origin = fullname[cls._baselen:]
+
+ print('[%s] *** %s ***' % (origin, msg))