summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2016-07-25 13:44:46 +0100
committerGitHub <noreply@github.com>2016-07-25 13:44:46 +0100
commite73ad8de3b4cb3e9fa13d84d6034166e10c86be4 (patch)
tree9830ef5657d05824faafaa6d290982d7b40df05c /tests
parentMerge pull request #944 from matrix-org/rav/devices_returns_list (diff)
parentSlightly saner logging for unittests (diff)
downloadsynapse-e73ad8de3b4cb3e9fa13d84d6034166e10c86be4.tar.xz
Merge pull request #947 from matrix-org/rav/unittest_logging
Slightly saner logging for unittests
Diffstat (limited to 'tests')
-rw-r--r--tests/unittest.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index 5b22abfe74..38715972dd 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -17,13 +17,18 @@ from twisted.trial import unittest
 
 import logging
 
-
 # logging doesn't have a "don't log anything at all EVARRRR setting,
 # but since the highest value is 50, 1000000 should do ;)
 NEVER = 1000000
 
-logging.getLogger().addHandler(logging.StreamHandler())
+handler = logging.StreamHandler()
+handler.setFormatter(logging.Formatter(
+    "%(levelname)s:%(name)s:%(message)s  [%(pathname)s:%(lineno)d]"
+))
+logging.getLogger().addHandler(handler)
 logging.getLogger().setLevel(NEVER)
+logging.getLogger("synapse.storage.SQL").setLevel(NEVER)
+logging.getLogger("synapse.storage.txn").setLevel(NEVER)
 
 
 def around(target):
@@ -70,8 +75,6 @@ class TestCase(unittest.TestCase):
                     return ret
 
             logging.getLogger().setLevel(level)
-            # Don't set SQL logging
-            logging.getLogger("synapse.storage").setLevel(old_level)
             return orig()
 
     def assertObjectHasAttributes(self, attrs, obj):