Fix unit test to use temp path instead of writing files locally - #1449
Open
andrewelamb wants to merge 3 commits into
Open
Fix unit test to use temp path instead of writing files locally#1449andrewelamb wants to merge 3 commits into
andrewelamb wants to merge 3 commits into
Conversation
thomasyu888
approved these changes
Aug 26, 2026
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.
Problem:
Running the unit test suite left two artifacts behind in the current working directory that were never cleaned up: a
manifest.csvfile and afolder_name/directory (containing its ownmanifest.csv).pytest tests/unitfrom the repo root and checkinggit statusafterwards.test_sync_from_synapse_manifest_is_suppressintests/unit/synapseutils/unit_test_synapseutils_sync.py, which callssyncFromSynapsewithpath="./".Solution:
Changed the test to use pytest's
tmp_pathfixture instead of"./", so any files written by the sync land in a pytest-managed temp directory instead of the repo root:tmp_path: Pathparameter to the test signature (with thepathlib.Pathimport).path=str(tmp_path)tosyncFromSynapseand updated the twodownload_locationassertions to match.Testing:
pytest tests/unit/synapseutils/unit_test_synapseutils_sync.py::test_sync_from_synapse_manifest_is_suppress— passes.git statusthat nomanifest.csvorfolder_name/artifacts are created in the working directory after the run.