From 27d93b5f31643336a98ecf2e5e7a781c6b8b7735 Mon Sep 17 00:00:00 2001 From: Athanasius <github@miggy.org> Date: Mon, 5 Sep 2022 12:17:54 +0100 Subject: [PATCH] tests: journal_lock: Need <factory>.getbasetemp() and str() as necessary --- tests/journal_lock.py/test_journal_lock.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/journal_lock.py/test_journal_lock.py b/tests/journal_lock.py/test_journal_lock.py index 3a8c11cb..22708edf 100644 --- a/tests/journal_lock.py/test_journal_lock.py +++ b/tests/journal_lock.py/test_journal_lock.py @@ -116,7 +116,7 @@ class TestJournalLock: def get_str(key: str, *, default: str = None) -> str: """Mock config.*Config get_str to provide fake journaldir.""" if key == 'journaldir': - return str(tmp_path_factory) + return str(tmp_path_factory.getbasetemp()) print('Other key, calling up ...') return config.get_str(key) # Call the non-mocked @@ -148,7 +148,8 @@ class TestJournalLock: # Tests against JournalLock.__init__() def test_journal_lock_init(self, mock_journaldir: py_path_local_LocalPath): """Test JournalLock instantiation.""" - tmpdir = str(mock_journaldir) + print(f'{type(mock_journaldir)=}') + tmpdir = str(mock_journaldir.getbasetemp()) jlock = JournalLock() # Check members are properly initialised. @@ -344,6 +345,8 @@ class TestJournalLock: assert jlock.journal_dir != old_journaldir assert jlock.locked + assert jlock.release_lock() + def test_update_lock_same(self, mock_journaldir: py_path_local_LocalPath): """ Test JournalLock.update_lock().