Skip to content

Commit

Permalink
Update compatibility tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson committed Feb 20, 2024
1 parent 177aef6 commit 72d79c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions compatibility_tests/test_file_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,21 @@ def env_path(asdf_version, tmp_path_factory):


@pytest.fixture(autouse=True)
def _pushd_tmpdir(tmpdir):
def _pushd_tmp_path(tmp_path):
"""
Change the working directory, in case the user is running these
tests from the repo root. Python will import a module from the
current working directory by preference, so this prevents us
from accidentally comparing the current library code to itself.
"""
original_cwd = os.getcwd()
tmpdir.chdir()
tmp_path.chdir()
yield
os.chdir(original_cwd)


@pytest.mark.remote_data()
def test_file_compatibility(asdf_version, env_path, tmpdir):
def test_file_compatibility(asdf_version, env_path, tmp_path):
# Sanity check to ensure we're not accidentally comparing
# the current code to itself.
installed_version = get_installed_version(env_path)
Expand All @@ -188,7 +188,7 @@ def test_file_compatibility(asdf_version, env_path, tmpdir):
# Confirm that a file generated by the current version of the code
# can be read by the older version of the library.
if asdf_version >= MIN_VERSION_NEW_FILES:
current_file_path = Path(str(tmpdir)) / "test-current.asdf"
current_file_path = Path(str(tmp_path)) / "test-current.asdf"
generate_file(current_file_path, standard_version)
assert env_run(env_path, "python3", ASSERT_SCRIPT_PATH, current_file_path, capture_output=True), (
f"asdf library version {asdf_version} failed to read an ASDF Standard {standard_version} "
Expand All @@ -198,7 +198,7 @@ def test_file_compatibility(asdf_version, env_path, tmpdir):
# Confirm that a file generated by the older version of the library
# can be read by the current version of the code.
if asdf_version >= MIN_VERSION_OLD_FILES:
old_file_path = Path(str(tmpdir)) / "test-old.asdf"
old_file_path = Path(str(tmp_path)) / "test-old.asdf"
assert env_run(
env_path,
"python3",
Expand Down

0 comments on commit 72d79c9

Please sign in to comment.