diff --git a/src/pyquickhelper/pycode/unittestclass.py b/src/pyquickhelper/pycode/unittestclass.py index e3bacd3b..139a5193 100644 --- a/src/pyquickhelper/pycode/unittestclass.py +++ b/src/pyquickhelper/pycode/unittestclass.py @@ -23,7 +23,8 @@ class ExtTestCase(unittest.TestCase): *PendingDeprecationWarning* are filtered out. """ - def setUp(self): + @classmethod + def setUpClass(cls): """ Filters out *FutureWarning*, *PendingDeprecationWarning*. """ @@ -33,7 +34,8 @@ def setUp(self): ImportWarning, DeprecationWarning)) - def tearDown(self): + @classmethod + def tearDownClass(cls): """ Stops filtering out *FutureWarning*, *PendingDeprecationWarning*. """ @@ -545,7 +547,10 @@ def __len__(self): raise AssertionError( # pragma: no cover "Logger %r has no handlers." % logger_name) + prop = logger.propagate + logger.propagate = False res = fct() + logger.propagate = prop logs = log_capture_string.getvalue() logger.removeHandler(ch)