Skip to content

Commit 7f24eb8

Browse files
authored
Merge pull request #410 from mabruzzo/gracklepy-test-bugfix
test bugfix: use `shutil.move` in test_models.py
2 parents 8d453e4 + 25ed3fb commit 7f24eb8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/python/tests/test_models.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import pytest
3+
import shutil
34
import sys
45
import yt
56

@@ -57,7 +58,14 @@ def test_model(answertestspec, tmp_path, model_name, par_index, input_index):
5758
answer_path = os.path.join(answertestspec.answer_dir, output_basename)
5859

5960
if answertestspec.generate_answers:
60-
os.rename(output_file, answer_path)
61+
# use shutil.move over os.rename in case output_file & answer_path
62+
# specify locations on different file systems
63+
# -> this is common since we using pytest's tmp_path machinery to
64+
# determine output_file. Unless overriden, this use's the
65+
# platform's standard directory for temporary files
66+
# -> On some platforms, especially linux, this location is entirely
67+
# stored in RAM
68+
shutil.move(output_file, answer_path)
6169
else:
6270
assert os.path.exists(answer_path)
6371

0 commit comments

Comments
 (0)