Skip to content

Commit a57bfe0

Browse files
committed
release: remove CI environment variables
pytest auto-detects and uses more verbose output when running in CI. Change our release script to forcefully remove those environment variables before running `regendoc`, because we do not want extra verbose output in the user documentation.
1 parent 21ad5c6 commit a57bfe0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

scripts/release.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,19 @@ def announce(version: str, template_name: str, doc_version: str) -> None:
7979
def regen(version: str) -> None:
8080
"""Call regendoc tool to update examples and pytest output in the docs."""
8181
print(f"{Fore.CYAN}[generate.regen] {Fore.RESET}Updating docs")
82+
env = os.environ.copy()
83+
84+
# Force setuptools-scm to use the requested version for the package.
85+
env["SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST"] = version
86+
87+
# Remove CI markers: pytest auto-detects those and uses more verbose output, which is undersirable
88+
# for the example documentation.
89+
env.pop("CI", None)
90+
env.pop("BUILD_NUMBER", None)
91+
8292
check_call(
8393
["tox", "-e", "regen"],
84-
env={**os.environ, "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST": version},
94+
env=env
8595
)
8696

8797

src/_pytest/compat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ def __call__(self) -> bool:
310310
def running_on_ci() -> bool:
311311
"""Check if we're currently running on a CI system."""
312312
# Only enable CI mode if one of these env variables is defined and non-empty.
313+
# Note: review `scripts/release.py` in case this list is changed.
313314
env_vars = ["CI", "BUILD_NUMBER"]
314315
return any(os.environ.get(var) for var in env_vars)
315316

0 commit comments

Comments
 (0)