Test refactoring and extension

Make all test classes subclasses of CleanupExitMocker
Use unittest's test id for dir/file names for easier debugging
Add some extra getLock tests