Skip to content

Commit 8e9030e

Browse files
RonnyPfannschmidtCursor AIclaude
committed
fix(downstream): remove CI env vars for tox instead of overriding
tox's is_ci() checks presence of CI (any value) and GITHUB_ACTIONS==true. Setting CI=false still leaves it present, so is_ci() returns True. Now empty-string env values mean "remove from environment" in the driver, and tox recipe uses CI="" and GITHUB_ACTIONS="" to fully unset them. Co-authored-by: Cursor AI <ai@cursor.sh> Co-authored-by: Anthropic Claude Opus 4 <claude@anthropic.com>
1 parent b19904e commit 8e9030e

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

downstream/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ sections plus tests:
2222
3. **`[[test]]`** — one or more `argv` arrays. For `uv-venv` / `stdlib-venv`, the
2323
driver sets **`VIRTUAL_ENV`** and prepends the venv’s `bin` (or `Scripts` on
2424
Windows) to **`PATH`**, so test commands can use bare names like `pytest`.
25-
Optional **`env`** table sets extra environment variables for the step (e.g.
26-
`env = { CI = "false" }` to suppress CI-only behaviour in a downstream suite).
25+
Optional **`env`** table sets extra environment variables for the step;
26+
an empty string removes the variable from the environment (e.g.
27+
`env = { CI = "" }` to unset `CI` and suppress CI-only behaviour).
2728
Install only: `--only-install`.
2829

2930
Run the driver (PEP 723 in `run_downstream.py`):

downstream/recipes/tox.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ groups = ["test"]
1414

1515
[[test]]
1616
argv = ["pytest"]
17-
# tox's is_ci() checks CI, GITHUB_ACTIONS, and many other env vars;
18-
# all must be unset/false so list_dependencies defaults to False and
19-
# test expectations (no freeze steps, spinner enabled, etc.) hold.
20-
env = { CI = "false", GITHUB_ACTIONS = "false" }
17+
# tox's is_ci() checks presence of CI, value of GITHUB_ACTIONS, and
18+
# other env vars. Empty string = remove from environment, non-empty
19+
# overrides value. Both must be gone for list_dependencies to default
20+
# to False and test expectations (no freeze steps, etc.) to hold.
21+
env = { CI = "", GITHUB_ACTIONS = "" }

downstream/run_downstream.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ def subprocess_env(
161161
venv_home: Path | None,
162162
) -> dict[str, str]:
163163
env = {**os.environ, **dict(extra or {})}
164+
# Empty-string values mean "remove from environment".
165+
for key, val in list(env.items()):
166+
if val == "":
167+
del env[key]
164168
if venv_home is None:
165169
return env
166170
root = venv_home.resolve()

0 commit comments

Comments
 (0)