mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 16:27:13 +03:00
tests: journal_lock: Close filehandle in test_obtain_lock_already_locked()
After the test completes as expected (ALREADY_LOCKED), ensure we close the filehandle for that, else it seems to interfere with the sub-process cleanup, which then leads to subsequent tests not being able to cleanup. Tests as now working after 10s of runs of `pytest` in a loop.
This commit is contained in:
parent
77e7f71ee3
commit
480b0712dd
@ -70,6 +70,7 @@ def other_process_lock(continue_q: mp.Queue, exit_q: mp.Queue, lockfile: pathlib
|
||||
exit_q.get(block=True, timeout=None)
|
||||
|
||||
# And clean up
|
||||
_release_lock('sub-process', lf)
|
||||
os.unlink(lockfile / 'edmc-journal-lock.txt')
|
||||
|
||||
|
||||
@ -329,6 +330,8 @@ class TestJournalLock:
|
||||
# Fails on Linux, because flock(2) is per process, so we'd need to
|
||||
# use multiprocessing to test this.
|
||||
assert second_attempt == JournalLockResult.ALREADY_LOCKED
|
||||
# And need to release any handles on the lockfile
|
||||
jlock.journal_dir_lockfile.close()
|
||||
print('Telling sub-process to quit...')
|
||||
exit_q.put('quit')
|
||||
print('Waiting for sub-process...')
|
||||
|
Loading…
x
Reference in New Issue
Block a user