write output files from Python tests to temporary system directory rather than source subdirectory #1121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Several of the Python tests create output files due to e.g.
output_epsilon
,save_flux
,Animate2D
, etc. which are placed in thepython/tests
subdirectory duringmake check
. As a security measure, some operating systems prevent the test suite from writing any kind of file to disk in non-temporary system directories. This PR modifies the output directory of any test which creates a file to a temporary directory determined by the OS at runtime viatempfile.mkdtemp
.Additionally, all instances of
os.path.realpath
are replaced withos.path.abspath
since on certain systems expanding".."
usingrealpath
is not allowed.TODOs:
since MPB does not contain the equivalent of Meep'suse_output_directory
parameter, the only test that is left out is python/tests/mpb.cpp.modify the C++ tests in
tests
which also generate output files to write them to a temporary directory.note: the tests on Travis are failing due to the following error: