From e5d847ec853dcb8840e27b34e6bde6e0ed433395 Mon Sep 17 00:00:00 2001 From: "Jeremy M. G. Leung" Date: Thu, 9 Jan 2025 15:42:31 -0500 Subject: [PATCH] use tmp_path instead of tmp_dir --- tests/conftest.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 57d6be85..01d494d9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,6 @@ import pytest import os import glob -import tempfile from shutil import copyfile, copy import westpa @@ -30,13 +29,13 @@ def clear_state(): @pytest.fixture -def ref_3iter(request): +def ref_3iter(request, tmp_path): """ Fixture that prepares a simulation directory with a completed 3-iteration WESTPA, west.h5, plus the config file west.cfg """ - test_dir = tempfile.mkdtemp() + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir) @@ -53,12 +52,12 @@ def ref_3iter(request): @pytest.fixture -def ref_cfg(request, tmpdir): +def ref_cfg(request, tmp_path): """ Fixture that prepares a simulation directory with a populated west.cfg file. """ - test_dir = str(tmpdir) + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir) @@ -77,13 +76,13 @@ def ref_cfg(request, tmpdir): @pytest.fixture -def ref_initialized(request, tmpdir): +def ref_initialized(request, tmp_path): """ Fixture that prepares a simulation directory with an initialized WESTPA system, west.h5, plus the config file west.cfg """ - test_dir = str(tmpdir) + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir) @@ -101,13 +100,13 @@ def ref_initialized(request, tmpdir): @pytest.fixture -def ref_50iter(request, tmpdir): +def ref_50iter(request, tmp_path): """ Fixture that prepares a simulation directory with a completed 50-iteration WESTPA, west.h5, plus the config file west.cfg """ - test_dir = str(tmpdir) + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir) @@ -125,13 +124,13 @@ def ref_50iter(request, tmpdir): @pytest.fixture -def ref_multi(request, tmpdir): +def ref_multi(request, tmp_path): """ Fixture that prepares a simulation directory for w_multi_west, including a master folder with sub folders 01, 02, 03 containing west_aux_ref.h5 renamed as west.h5. """ - test_dir = str(tmpdir) + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir) @@ -155,13 +154,13 @@ def ref_multi(request, tmpdir): @pytest.fixture -def ref_multi_noaux(request, tmpdir): +def ref_multi_noaux(request, tmp_path): """ Fixture that prepares a simulation directory for w_multi_west, including a master folder with sub folders 01, 02, 03 containing west_aux_ref.h5 renamed as west.h5. """ - test_dir = str(tmpdir) + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir) @@ -185,11 +184,11 @@ def ref_multi_noaux(request, tmpdir): @pytest.fixture -def ref_idtype(request): +def ref_idtype(request, tmp_path): """ Fixture that prepares the west.h5 file and also links in the "correct" istate dtype array. """ - test_dir = tempfile.mkdtemp() + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir) @@ -206,12 +205,12 @@ def ref_idtype(request): @pytest.fixture -def ref_executable(request, tmpdir): +def ref_executable(request, tmp_path): """ Fixture that prepares a simulation directory with a populated west_executable.cfg file. """ - test_dir = str(tmpdir) + test_dir = str(tmp_path) os.chdir(test_dir) copy_ref(test_dir)