Repository navigation
Stop tests from leaving files in the system temporary directory - #968
Merged
Merged
Conversation
Every test run left files in the system temporary directory: - run_process_for_descs created its description file with delete=False on every platform, but removed it only on Windows. So every integration test that calls it left a tmpXXXXXXXX.json behind. - Three GPX parsing tests wrote their GPX file with delete=False and never removed it. - The TestImageSequenceUploader tests upload in dry-run mode without setting MAPILLARY_UPLOAD_ENDPOINT, so they uploaded to the default mapillary_public_uploads directory in the temporary directory. The fixture now writes the description file in a temporary directory that is removed afterwards, the GPX tests write to tmp_path, and the uploader tests upload to a directory in tmp_path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Every test run left files in the system temporary directory. With
TMPDIRset to an empty directory, the unit and integration tests left 153 entries in it on main:tmpXXXXXXXX.json:run_process_for_descscreated its description file withdelete=Falseon every platform, but removed it only on Windows.tmpXXXXXXXX.gpx: three GPX parsing tests wrote their GPX file withdelete=Falseand never removed it.mapillary_public_uploads/(42 files): theTestImageSequenceUploadertests upload in dry-run mode without settingMAPILLARY_UPLOAD_ENDPOINT, so the uploads went to the default directory in the temporary directory.The fixture now writes the description file in a temporary directory that is removed afterwards, so it no longer keeps a file open while the command writes to it (the Windows problem in #503). The GPX tests write to
tmp_path, and the uploader tests upload to a directory intmp_path.With this change the same run leaves nothing besides pytest's own
pytest-of-<user>directory, and all tests still pass.