Skip to content

Conversation

macdjord
Copy link

@macdjord macdjord commented Oct 1, 2025

Previously, if either $CI or $BUILD_NUMBER was defined, CI mode would be activated, even if the variable was set to the empty string. This had some unfortunate consequences:

  • The easy and obvious method of setting those variables, i.e. CI="${OTHER_VAR}", would not work, because $CI would always end up being defined even if $OTHER_VAR was undefined.
  • The easy and obvious method of clearing those variables at runtime, i.e. CI="" pytest ..., would not work, because again $CI would still be defined even though it was blank.

Now, at least one of those variables must be set to a non-empty string in order to enable CI mode.

Closes #13766

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 1, 2025
@Pierre-Sassoulas
Copy link
Member

Thank you for opening the issue, #13767 is moving it elsewhere you'll probably need to rebase on it when it's merged.

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

No worries about the rebase, I will handle it, along with a few minor changes. Out of abundance of caution I will also mark this a breaking change. The next release is 9.0 so that's OK :)

… string

Previously, if either env variable was defined, CI mode would be activated,
even if the variable was set to the empty string.
This had some unfortunate consequences:
* The easy and obvious method of setting those variables,
  i.e. `CI="${OTHER_VAR}"`,
  would not work,
  because `$CI` would always end up being defined
  even if `$OTHER_VAR` was undefined.
* The easy and obvious method of clearing those variables at runtime,
  i.e. `CI="" pytest ...`,
  would not work,
  because again `$CI` would still be defined even though it was blank.

Now, at least one of those variables must be set to a non-empty string
in order to enabled CI mode.

Closes pytest-dev#13766
@bluetech bluetech force-pushed the improve_ci_detection branch from cfe90bc to 304743c Compare October 1, 2025 07:41
@bluetech
Copy link
Member

bluetech commented Oct 1, 2025

macos CI is down, I doubt it's relevant here, so force-merging.

@bluetech bluetech merged commit 42c9fe0 into pytest-dev:main Oct 1, 2025
28 of 32 checks passed
@macdjord macdjord deleted the improve_ci_detection branch October 1, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI Pipeline Detection Issues
3 participants