From 3e772c8eaca620749ac515eb02c5c97c6e49efb7 Mon Sep 17 00:00:00 2001 From: Joscha Schmiedt <joscha@schmiedt.dev> Date: Wed, 27 Nov 2024 23:20:30 +0100 Subject: [PATCH] TST: Skip logger test on Windows # TODO: this test is problematic on Windows due to the file being locked # by the logger. This is a known issue and should be fixed in the # future. # For now, the test is disabled on Windows. # See https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile --- unittests/test_suppressKnown.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unittests/test_suppressKnown.py b/unittests/test_suppressKnown.py index d148a5a3..c3e65dbe 100644 --- a/unittests/test_suppressKnown.py +++ b/unittests/test_suppressKnown.py @@ -60,11 +60,17 @@ class SupTestAdvanced(SupTestBasic): self.db_file = os.path.join(gettempdir(), "test_suppress_msg_db_file_advanced.db") self.basic = SuppressKnown(db_file=self.db_file) + @unittest.skipIf(os.name == "nt", "Known issue on Windows, see https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile") def test_logger(self): """ The logging output is directed to a file which is then checked whether the output is as expected. """ + # TODO: this test is problematic on Windows due to the file being locked + # by the logger. This is a known issue and should be fixed in the + # future. + # For now, the test is disabled on Windows. + # See https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile logfile = NamedTemporaryFile(delete=False, mode="w") logger = logging.getLogger() logger.addHandler(logging.FileHandler(logfile.name)) -- GitLab