Remove all other log handlers when capturing logs
authorGuido Günther <agx@sigxcpu.org>
Mon, 28 Jul 2014 13:57:05 +0000 (15:57 +0200)
committerGuido Günther <agx@sigxcpu.org>
Mon, 28 Jul 2014 13:57:05 +0000 (15:57 +0200)
This avoids spurious error messages during test runs.

tests/component/__init__.py

index 4ef22563c8405d2bc3a09e3b960a1f70f0c47067..7abb16d12bc972f3f6b3e38ee67d583ea142ffff 100644 (file)
@@ -153,6 +153,8 @@ class ComponentTestBase(object):
             self._loghandler = gbp.log.GbpStreamHandler(self._log, False)
             self._loghandler.addFilter(gbp.log.GbpFilter([gbp.log.WARNING,
                                                           gbp.log.ERROR]))
+            for hdl in gbp.log.LOGGER.handlers:
+                gbp.log.LOGGER.removeHandler(hdl)
             gbp.log.LOGGER.addHandler(self._loghandler)
         elif self._log is not None:
             gbp.log.LOGGER.removeHandler(self._loghandler)