diff --git a/changes/3371.misc.rst b/changes/3371.misc.rst new file mode 100644 index 0000000000..06655ee402 --- /dev/null +++ b/changes/3371.misc.rst @@ -0,0 +1 @@ +Ensure that tests for executable examples are run in a fresh python environment. \ No newline at end of file diff --git a/tests/test_examples.py b/tests/test_examples.py index c97766364b..54af4119e3 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -72,7 +72,9 @@ def test_scripts_can_run(script_path: Path, tmp_path: Path) -> None: # and then test its behavior. # This allows the example to be useful to users who don't have Zarr installed, but also testable. resave_script(script_path, dest_path) - result = subprocess.run(["uv", "run", str(dest_path)], capture_output=True, text=True) + result = subprocess.run( + ["uv", "run", "--refresh", str(dest_path)], capture_output=True, text=True + ) assert result.returncode == 0, ( f"Script at {script_path} failed to run. Output: {result.stdout} Error: {result.stderr}" )