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.
Only tested under win32 so far, but I'd hope os.chmod() is the way to go
on Linux and macOS.
The win32 implementation currently relies on the pywin32 package being
installed in order to use its ntsecuritycon and win32security modules.
It might be possible to do this with ctypes instead, but this sure looks
cleaner than most ctypes code I've seen.
* mock get_str() is now via a fixture so it can be re-used in more than
one test, avoiding DRY issue.
* Some actual tests, in the form of asserts, added to
test_journal_lock_init().
In general I think this will keep things neater:
1. Create a directory inside tests/ named after the file the tests are
for.
2. Put all files for that test inside this new directory.