Skip to content

Commit c21d1f9

Browse files
authored
ensure that we test examples with a fresh env (#3371)
* ensure that we test examples with a fresh env * changelog
1 parent 90fb2bd commit c21d1f9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

changes/3371.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure that tests for executable examples are run in a fresh python environment.

tests/test_examples.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def test_scripts_can_run(script_path: Path, tmp_path: Path) -> None:
7272
# and then test its behavior.
7373
# This allows the example to be useful to users who don't have Zarr installed, but also testable.
7474
resave_script(script_path, dest_path)
75-
result = subprocess.run(["uv", "run", str(dest_path)], capture_output=True, text=True)
75+
result = subprocess.run(
76+
["uv", "run", "--refresh", str(dest_path)], capture_output=True, text=True
77+
)
7678
assert result.returncode == 0, (
7779
f"Script at {script_path} failed to run. Output: {result.stdout} Error: {result.stderr}"
7880
)

0 commit comments

Comments
 (0)