Updated log names. Should be easier to find if you forget to delete old logs. Now just called fenrir.log, we don't tend to need to have multiple logs anyway.
This commit is contained in:
1 parent
15f2435749
commit
0c4fe50606
10 files changed
+128
-25
No files matched your search
@@ -0,0 +1,59 @@
|
||||
from fenrirscreenreader.core.debugManager import DebugManager
|
||||
|
||||
|
||||
def test_default_debug_file_uses_flat_name(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(DebugManager, "DEFAULT_LOG_DIR", str(tmp_path))
|
||||
manager = DebugManager()
|
||||
try:
|
||||
manager.open_debug_file()
|
||||
|
||||
assert manager.get_debug_file() == str(tmp_path / "fenrir.log")
|
||||
assert (tmp_path / "fenrir.log").exists()
|
||||
finally:
|
||||
manager.close_debug_file()
|
||||
|
||||
|
||||
def test_default_debug_file_uses_next_number_when_locked(
|
||||
tmp_path, monkeypatch
|
||||
):
|
||||
monkeypatch.setattr(DebugManager, "DEFAULT_LOG_DIR", str(tmp_path))
|
||||
first_manager = DebugManager()
|
||||
second_manager = DebugManager()
|
||||
try:
|
||||
first_manager.open_debug_file()
|
||||
second_manager.open_debug_file()
|
||||
|
||||
assert first_manager.get_debug_file() == str(tmp_path / "fenrir.log")
|
||||
assert second_manager.get_debug_file() == str(
|
||||
tmp_path / "fenrir2.log"
|
||||
)
|
||||
assert (tmp_path / "fenrir2.log").exists()
|
||||
finally:
|
||||
second_manager.close_debug_file()
|
||||
first_manager.close_debug_file()
|
||||
|
||||
|
||||
def test_default_debug_file_reuses_unlocked_flat_name(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(DebugManager, "DEFAULT_LOG_DIR", str(tmp_path))
|
||||
first_manager = DebugManager()
|
||||
second_manager = DebugManager()
|
||||
try:
|
||||
first_manager.open_debug_file()
|
||||
first_manager.close_debug_file()
|
||||
second_manager.open_debug_file()
|
||||
|
||||
assert second_manager.get_debug_file() == str(tmp_path / "fenrir.log")
|
||||
finally:
|
||||
second_manager.close_debug_file()
|
||||
|
||||
|
||||
def test_explicit_debug_file_uses_exact_path(tmp_path):
|
||||
debug_file = tmp_path / "custom.log"
|
||||
manager = DebugManager(str(debug_file))
|
||||
try:
|
||||
manager.open_debug_file()
|
||||
|
||||
assert manager.get_debug_file() == str(debug_file)
|
||||
assert debug_file.exists()
|
||||
finally:
|
||||
manager.close_debug_file()
|
||||
Reference in new issue
Block a user