diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-07-28 15:57:05 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-07-28 15:57:05 +0200 |
commit | 243b6fca2739d03f6e1086d23473d178f42df530 (patch) | |
tree | b8abbf68ec7d8e4533c40e82cec868303b8de400 | |
parent | 3f43e4ee68d2a169a3e604a6bd0b60f99b71d812 (diff) |
Remove all other log handlers when capturing logs
This avoids spurious error messages during test runs.
-rw-r--r-- | tests/component/__init__.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py index 4ef22563..7abb16d1 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) |