refact: improve logger handling

This commit is contained in:
sebthom
2025-02-10 20:34:58 +01:00
parent ec7ffedcd6
commit 367ef07798
4 changed files with 64 additions and 24 deletions

View File

@@ -41,10 +41,11 @@ class TestKleinanzeigenBot:
bot.configure_file_logging()
file_log = bot.file_log
assert not file_log.stream.closed # type: ignore[union-attr]
assert file_log is not None
assert not file_log.is_closed()
# Delete and garbage collect the bot instance to ensure the destructor (__del__) is called
del bot
gc.collect()
assert file_log.stream is None # type: ignore[union-attr]
assert file_log.is_closed()