Skip to content

Commit 9b4ab57

Browse files
authored
MAINT: use tempfiles in tests (#100)
1 parent 2dbb69f commit 9b4ab57

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

q2_assembly/tests/test_utils.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,12 @@ def test_file_concatenation(self):
161161
hash_original = hashlib.md5(open(concat_file, mode="rb").read()).hexdigest()
162162

163163
# output of our method
164-
output_file = self.get_data_path(
165-
"reads/small-single-end/file1_file2_concat.fastq"
166-
)
167-
concatenate_files([file1, file2], output_file)
168-
hash_test_file = hashlib.md5(open(output_file, "rb").read()).hexdigest()
164+
output_file = tempfile.NamedTemporaryFile()
165+
concatenate_files([file1, file2], output_file.name)
166+
hash_test_file = hashlib.md5(open(output_file.name, "rb").read()).hexdigest()
169167

170168
self.assertEqual(hash_original, hash_test_file)
171-
os.remove(output_file)
169+
output_file.close()
172170

173171
@parameterized.expand(("shortuuid", "uuid3", "uuid4", "uuid5"))
174172
def test_modify_contig_ids(self, uuid_type):

0 commit comments

Comments
 (0)