Visitar URL original
fix(config): fail on an invalid platform regex by 00200200 · Pull Request #4104 · tox-dev/tox · GitHub
Skip to content

fix(config): fail on an invalid platform regex - #4104

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
00200200:fix/invalid-platform-regex
Sep 29, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
00200200:fix/invalid-platform-regex

Conversation

@00200200

@00200200 00200200 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

An invalid platform value, such as platform = "linux(", made tox print an internal error with a traceback. A valid
expression that does not match skips the environment. A malformed one now fails it with a one-line error, as tox
already does for an invalid --skip-env pattern (#4029).

# before
$ tox r -e py
py: internal error
Traceback (most recent call last):
  ...
re.error: missing ), unterminated subpattern at position 5
  py: FAIL code 2

# after
$ tox r -e py
py: invalid platform regular expression 'linux(': missing ), unterminated subpattern at position 5
  py: FAIL code 1

The same applies when provisioning. An invalid platform on the .tox environment stops the run with one line:

ROOT: HandledError| invalid platform regular expression 'linux(': missing ), unterminated subpattern at position 5

Closes #4103.

  • ran the linter to address style issues
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation (platform now notes that an invalid regex fails the environment)

An invalid platform value currently raises re.error as an internal
error. Report it as a Fail so the environment exits with a one-line
message, matching --skip-env handling.
Fail escaped run_provision, which catches only Skip, so an invalid
platform on the .tox environment still printed a traceback. Raise
HandledError instead: the env runner and the top-level entry point both
report it as a one-line error.

@gaborbernat gaborbernat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@gaborbernat
gaborbernat enabled auto-merge (squash) September 29, 2026 16:17
@gaborbernat
gaborbernat merged commit d254559 into tox-dev:main Sep 29, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid platform regex leaks an internal traceback

2 participants