We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 193bac1 commit 02bcc2cCopy full SHA for 02bcc2c
1 file changed
test/test_uv_env_setup.py
@@ -0,0 +1,26 @@
1
+"""Tests for uv_env_setup.sh error handling."""
2
+
3
+import subprocess
4
+from pathlib import Path
5
6
7
+def test_source_invalid_platform_does_not_kill_shell():
8
+ """Verify sourcing with invalid platform does not kill the shell.
9
10
+ If the script uses bare `exit 1`, sourcing it kills the shell
11
+ (subshell exits). If it uses `return 1`, the subshell survives
12
+ and the sentinel `STILL_ALIVE` is printed.
13
+ """
14
+ script = Path(__file__).parents[1] / "uv_env_setup.sh"
15
+ result = subprocess.run(
16
+ [
17
+ "bash",
18
+ "-c",
19
+ f"source {script} INVALID 2>/dev/null; echo STILL_ALIVE",
20
+ ],
21
+ capture_output=True,
22
+ text=True,
23
+ )
24
+ assert "STILL_ALIVE" in result.stdout, (
25
+ "Shell was killed by `exit 1` instead of `return 1`"
26
0 commit comments