Skip to content

Commit 6abb750

Browse files
aymuos15ericspod
andauthored
Fix nnUNet test directory leakage into current working directory (#8887)
Fixes #8886 ### Types of changes - [x] Non-breaking change (fix or new feature that would not break existing functionality). --------- Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent 2b50110 commit 6abb750

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

‎tests/integration/test_integration_nnunetv2_runner.py‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -107,41 +107,41 @@ def setUp(self) -> None:
107107
self.good_yml2 = os.path.join(test_path, "good2.yml")
108108
self.inject_yml = os.path.join(test_path, "test.yml")
109109

110-
good_yml_content1 = """
110+
good_yml_content1 = f"""
111111
dataset_name_or_id: Dataset123
112-
dataroot: ./data
113-
datalist: ./lists/task4.json
114-
work_dir: ./work
115-
nnunet_raw: ./nnUNet_raw
116-
nnunet_preprocessed: ./nnUNet_preprocessed
117-
nnunet_results: ./nnUNet_results
112+
dataroot: {test_path}/data
113+
datalist: {test_path}/lists/task4.json
114+
work_dir: {test_path}/work
115+
nnunet_raw: {test_path}/nnUNet_raw
116+
nnunet_preprocessed: {test_path}/nnUNet_preprocessed
117+
nnunet_results: {test_path}/nnUNet_results
118118
"""
119119

120120
with open(self.good_yml1, "w") as o:
121121
o.write(dedent(good_yml_content1))
122122

123-
good_yml_content2 = """
123+
good_yml_content2 = f"""
124124
dataset_name_or_id: 123
125-
dataroot: ./data
126-
datalist: ./lists/task4.json
127-
work_dir: ./work
128-
nnunet_raw: ./nnUNet_raw
129-
nnunet_preprocessed: ./nnUNet_preprocessed
130-
nnunet_results: ./nnUNet_results
125+
dataroot: {test_path}/data
126+
datalist: {test_path}/lists/task4.json
127+
work_dir: {test_path}/work
128+
nnunet_raw: {test_path}/nnUNet_raw
129+
nnunet_preprocessed: {test_path}/nnUNet_preprocessed
130+
nnunet_results: {test_path}/nnUNet_results
131131
"""
132132

133133
with open(self.good_yml2, "w") as o:
134134
o.write(dedent(good_yml_content2))
135135

136136
# define a config file with code-injecting dataset name
137-
injecting_yml_content = """
138-
dataset_name_or_id: '4 & echo "This is exploited" > "./test.txt" & rem'
139-
dataroot: ./data
140-
datalist: ./lists/task4.json
141-
work_dir: ./work
142-
nnunet_raw: ./nnUNet_raw
143-
nnunet_preprocessed: ./nnUNet_preprocessed
144-
nnunet_results: ./nnUNet_results
137+
injecting_yml_content = f"""
138+
dataset_name_or_id: '4 & echo "This is exploited" > "{test_path}/test.txt" & rem'
139+
dataroot: {test_path}/data
140+
datalist: {test_path}/lists/task4.json
141+
work_dir: {test_path}/work
142+
nnunet_raw: {test_path}/nnUNet_raw
143+
nnunet_preprocessed: {test_path}/nnUNet_preprocessed
144+
nnunet_results: {test_path}/nnUNet_results
145145
"""
146146

147147
with open(self.inject_yml, "w") as o:

0 commit comments

Comments
 (0)