1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

tests: journal_lock: Need <factory>.getbasetemp() and str() as necessary

This commit is contained in:
Athanasius 2022-09-05 12:17:54 +01:00
parent 9915c5435d
commit 27d93b5f31
No known key found for this signature in database
GPG Key ID: 8C392035DD80FD62

View File

@ -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().