python-pywbem/support-new-testfixtures.patch

56 lines
2.1 KiB
Diff

From f6acfc45af0c8b5b592890a3ff222708902f2ae7 Mon Sep 17 00:00:00 2001
From: Andreas Maier <andreas.r.maier@gmx.de>
Date: Mon, 19 Aug 2024 18:29:10 +0200
Subject: [PATCH] Test: In test_recorder.py avoid a new AssertionError by
testfixtures 8.3.0
Details:
* The setup_method() in BaseLogOperationRecorderTests had called
logging.shutdown() which triggered a new AssertionError raised by
testfixtures 8.3.0 that complains about LogCapture handlers being closed
but still installed.
Uninstalling the LogCapture handlers via LogCapture.uninstall_all()
introduced the new problem that logging was not performed correctly
anymore.
The solution seems to be to not call logging.shutdown() in setup_method(),
which is also understandable given that it is only supposed to be used
before exiting the program.
Note that we still call it in teardown_method().
Fixed steps to start new version; removed types from _version.py
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
---
docs/changes.rst | 4 ++--
test-requirements.txt | 7 +------
tests/unittest/pywbem/test_recorder.py | 9 ++++-----
3 files changed, 7 insertions(+), 13 deletions(-)
ddiff --git a/tests/unittest/pywbem/test_recorder.py b/tests/unittest/pywbem/test_recorder.py
index be618fe15..f7eb1797a 100755
--- a/tests/unittest/pywbem/test_recorder.py
+++ b/tests/unittest/pywbem/test_recorder.py
@@ -1620,14 +1620,13 @@ def setup_method(self):
"""
Setup that is run before each test method.
"""
- # Shut down any existing logger and reset WBEMConnection and
- # reset WBEMConnection class attributes
- # pylint: disable=protected-access
- WBEMConnection._reset_logging_config()
- logging.shutdown()
+ # Reset WBEMConnection logging.
# NOTE We do not clean up handlers or logger names already defined.
# That should not affect the tests.
+ # pylint: disable=protected-access
+ WBEMConnection._reset_logging_config()
+
def recorder_setup(self, detail_level=None):
"""
Setup the recorder for a defined max output size