It's actually just the NAMES that got changed as part of the EDDN rework, so
this would have made no difference to the tests. But now a grep won't find
any instance of the old names.
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.
* Set `tmpdir` properly for this test.
* Do **NOT** unset `JournalLock.journal_dir_lockfile_name` on release, as
this is needed to remove the file
* Ensure prior test(s) release their locks, *and* remove the file.
* Some `# pragma: no cover' added where it's more pain to get coverage
than to put up with lack of testing.
We are choosing to NOT test retry_lock() or the call to it from
update_lock() as it's tkinter stuff.
* Check `self.journal_dir_lockfile` exists before trying to call
.close() on it.
* Note where platform checks means only one if branch gets run, so of
course coverage will complain about the other one.
* Add test_release_lock_lie_locked() to test when not locked, but
pretend we were so release_lock() returns False.
* Add test_update_lock_same() to check if an attempt is made to 'update'
to the same directory.
* update_lock() wants to, potentially, invoke
JournalLock.JournalAlreadyLocked() instance for a tkinter pop-up.
We do *not* want to mock all of that, so monkeypatch a mock so that in
the 'test PASSED' case this just works.
This splits the code for opening the lockfile away from that for
actually obtaining the lock. It enables a test for trying to lock again
with the same file handle.
* On win32 this uses pywin32 package modules, so that's now in
requirements-dev.txt.
* I *think* that code is as clean as it's going to be. Windows is a
pain with having you *append* a Deny ACL (rather than remove an Allow
one), and then you have to find it in all the ACLs for the object in
order to remove it by index.
* Linux version of this using `os.chmod()` currently untested.