claude-dev-env 8.48.1 → 8.48.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -28,6 +28,8 @@ _ENFORCER_SCRIPT = Path(__file__).resolve().parent / "code_rules_enforcer.py"
|
|
|
28
28
|
|
|
29
29
|
_VIOLATING_PRODUCTION_SOURCE = "def process_data(payload: str) -> None:\n print(payload)\n"
|
|
30
30
|
|
|
31
|
+
_DIRECTORY_OUTSIDE_TEMP_ROOTS = Path("/home/user")
|
|
32
|
+
|
|
31
33
|
|
|
32
34
|
def _run_enforcer_cli(
|
|
33
35
|
all_cli_arguments: list[str],
|
|
@@ -74,6 +76,7 @@ def test_should_return_false_for_os_tempfile_gettempdir_root(
|
|
|
74
76
|
"""
|
|
75
77
|
monkeypatch.delenv("CLAUDE_CODE_RULES_DISABLE_EPHEMERAL_EXEMPT", raising=False)
|
|
76
78
|
monkeypatch.delenv("CLAUDE_JOB_DIR", raising=False)
|
|
79
|
+
monkeypatch.setattr(tempfile, "tempdir", str(_DIRECTORY_OUTSIDE_TEMP_ROOTS / "os_temp_root"))
|
|
77
80
|
system_temp_root = tempfile.gettempdir()
|
|
78
81
|
scratch_path = str(Path(system_temp_root) / "scratch_work.py")
|
|
79
82
|
assert is_ephemeral_script_path(scratch_path) is False
|
|
@@ -82,7 +85,6 @@ def test_should_return_false_for_os_tempfile_gettempdir_root(
|
|
|
82
85
|
@pytest.mark.parametrize("env_name", ["TMPDIR", "TEMP", "TMP"])
|
|
83
86
|
def test_should_return_false_for_tmpdir_temp_tmp_env_roots(
|
|
84
87
|
env_name: str,
|
|
85
|
-
tmp_path: Path,
|
|
86
88
|
monkeypatch: pytest.MonkeyPatch,
|
|
87
89
|
) -> None:
|
|
88
90
|
"""B3: $TMPDIR / $TEMP / $TMP are not ephemeral sources.
|
|
@@ -92,8 +94,9 @@ def test_should_return_false_for_tmpdir_temp_tmp_env_roots(
|
|
|
92
94
|
"""
|
|
93
95
|
monkeypatch.delenv("CLAUDE_CODE_RULES_DISABLE_EPHEMERAL_EXEMPT", raising=False)
|
|
94
96
|
monkeypatch.delenv("CLAUDE_JOB_DIR", raising=False)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
env_root = _DIRECTORY_OUTSIDE_TEMP_ROOTS / "env_root"
|
|
98
|
+
monkeypatch.setenv(env_name, str(env_root))
|
|
99
|
+
scratch_path = str(env_root / "scratch.py")
|
|
97
100
|
assert is_ephemeral_script_path(scratch_path) is False
|
|
98
101
|
|
|
99
102
|
|
|
@@ -111,7 +114,8 @@ def test_should_return_false_for_pytest_tmp_path_when_job_dir_elsewhere(
|
|
|
111
114
|
"""
|
|
112
115
|
monkeypatch.delenv("CLAUDE_CODE_RULES_DISABLE_EPHEMERAL_EXEMPT", raising=False)
|
|
113
116
|
monkeypatch.setenv("CLAUDE_JOB_DIR", str(tmp_path / "elsewhere"))
|
|
114
|
-
|
|
117
|
+
monkeypatch.setattr(tempfile, "tempdir", str(_DIRECTORY_OUTSIDE_TEMP_ROOTS / "os_temp_root"))
|
|
118
|
+
pytest_sandbox_target = str(Path(tempfile.gettempdir()) / "pytest-of-user" / "candidate.py")
|
|
115
119
|
assert is_ephemeral_script_path(pytest_sandbox_target) is False
|
|
116
120
|
|
|
117
121
|
|