From 243b6fca2739d03f6e1086d23473d178f42df530 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Mon, 28 Jul 2014 15:57:05 +0200 Subject: Remove all other log handlers when capturing logs This avoids spurious error messages during test runs. --- tests/component/__init__.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/component/__init__.py b/tests/component/__init__.py index 4ef2256..7abb16d 100644 --- a/tests/component/__init__.py +++ b/tests/component/__init__.py @@ -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) -- cgit v1.2.3