Make test cases work in sandbox
Currently, test cases are run directly in the directory with test data. That has several consequences:
- all data files are directly available (and they could either be accidentally read, or overwritten);
- all result files will appear among them (and may not be cleaned up);
- test cases that overwrite input files (e.g. with option
--inplace) need to copy those input files anyway;
- it is harder to check that no spurious files were created by the subject under test (SUT).
The way test cases should have been set up is:
- create a sandbox directory;
- copy over exactly the files needed for the test case;
- let the SUT do its job;
- verify whether the expected files are there (no more, no less);
- verify other expectations;
- remove the sandbox directory, including all files in it.
Note that the last step needs to be performed
no matter what the result of the test case is.
In the current set up, whenever an assert fails,
the created files will not be removed
(because the commands to do so appear after the failing