From d6b00ef1bb1e3479053075382e7526b66189e683 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Wed, 24 Dec 2025 17:47:20 +0000 Subject: [PATCH] Change out of temp dirs in git version tests before closing so windows doesn't error --- tests/unit_tests/test_version_strings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit_tests/test_version_strings.py b/tests/unit_tests/test_version_strings.py index fc8fd817..6c4f935b 100644 --- a/tests/unit_tests/test_version_strings.py +++ b/tests/unit_tests/test_version_strings.py @@ -63,8 +63,10 @@ def temp_dir(): with tempfile.TemporaryDirectory() as tmpdir: os.chdir(tmpdir) yield tmpdir + # Change back to working dir before closing context manager or Windows will error + os.chdir(working_dir) finally: - # Return to original working dir + # Ensure changed to working dir os.chdir(working_dir) @@ -191,8 +193,10 @@ def test_reading_hash_from_git(): # Check out the branch and check commit changed back _git(f"checkout {branch_name}") assert utilities._get_hash_from_git_dir(git_dir) == git_hash2 + # Change back to working dir before closing context manager or Windows will error + os.chdir(working_dir) finally: - # Return to original working dir + # Ensure changed to working dir os.chdir(working_dir)