summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2014-09-12 18:43:49 +0100
committerPaul "LeoNerd" Evans <paul@matrix.org>2014-09-12 18:46:13 +0100
commitd9f3f322c5f17a4c3d3ac000462a7bbd0a407711 (patch)
tree76874409750777ae57e9065950952cbb02735281 /tests
parentDefine a (class) decorator for easily setting a DEBUG logging level on a Test... (diff)
downloadsynapse-d9f3f322c5f17a4c3d3ac000462a7bbd0a407711.tar.xz
Additionally look first for a 'loglevel' attribute on the running test method, before the TestCase
Diffstat (limited to '')
-rw-r--r--tests/unittest.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index c66a3b8407..8ae724c786 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -27,10 +27,14 @@ logging.getLogger().setLevel(NEVER)
 
 
 class TestCase(unittest.TestCase):
-    def __init__(self, *args, **kwargs):
-        super(TestCase, self).__init__(*args, **kwargs)
+    def __init__(self, methodName, *args, **kwargs):
+        super(TestCase, self).__init__(methodName, *args, **kwargs)
 
-        level = getattr(self, "loglevel", NEVER)
+        method = getattr(self, methodName)
+
+        level = getattr(method, "loglevel",
+                    getattr(self, "loglevel",
+                        NEVER))
 
         orig_setUp = self.setUp