Cleanups and Speedup for python unittests
I initially set out to just do some long overdue maintenance of our unit tests, along way I cleaned up a number of issues that have been bugging me for a while:
- use mock instead of try/finally blocks
- use os.enivon.get so that some things don't have to be set to run
- move a lot of constant setup to setUpClass instead of setUp, which means the fixtures get run less
- use more of our helpers instead of open coding
- make more use of
UnitTest.addCleanup - actually clean up more often, and move the cleanup code closer to the producer.
- Allow our cleanup of Meson calls to happen even if the call to Meson itself fails
- cleanup some complicated logic
- use better/faster types
- use properties for rarely used dynamic attributes
- Use tmpdir instead of source dir when we can reasonably assume that there will not be Anti-Virus, and allow Windows users to force the use of the tmpdir
For me the end result is a reduction in a full unit test run time by ~15%, and there are no stray files left in the source tree compared to the main branch.
I wont be surprised if there are a few regressions on Windows to clean up.
I've also reworded a few of the commit messages to fix typos, but I'll wait to re-push so I don't flood the CI
Squashed and re-ordered a bit to address comments from IRC/Matrix. Attempting to fix the one test that is failing on Windows
Partial review and partial merge of commits 85e92331c...4b76aabe3
Other than the one change LGTM.