Skip to content

Commit 66f72c6

Browse files
committed
Making sure tests clean the environment
1 parent ecd494e commit 66f72c6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

qiita_db/test/test_data.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ def test_delete(self):
261261
RawData.delete(rd.id, self.pt1.id)
262262

263263
# Clear the files so we can actually remove the RawData
264+
study_id = rd.studies[0]
265+
path_for_removal = join(get_mountpoint("uploads")[0][1], str(study_id))
266+
self._clean_up_files = [join(path_for_removal,
267+
basename(f).split('_', 1)[1])
268+
for _, f, _ in rd.get_filepaths()]
264269
rd.clear_filepaths()
265270

266271
RawData.delete(rd.id, self.pt1.id)

qiita_db/test/test_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,10 @@ def test_move_upload_files_to_trash(self):
575575

576576
# create file to move to trash
577577
fid, folder = get_mountpoint("uploads")[0]
578-
open(join(folder, '1', test_filename), 'w').write('test')
578+
test_fp = join(folder, '1', test_filename)
579+
open(test_fp, 'w').write('test')
580+
581+
self.files_to_remove.append(test_fp)
579582

580583
exp = [(fid, 'this_is_a_test_file.txt'), (fid, 'uploaded_file.txt')]
581584
obs = get_files_from_uploads_folders("1")

0 commit comments

Comments
 (0)