Skip to content

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Aug 8, 2025

Fix bug where tox is silently ignoring loading pyproject.toml files
that failed be loaded by tomllint and falling back to other config.

  • if pyproject.toml does not have one of the two expected sections
    it will be logged, so it would be visible with -v
  • make pyproject.toml failure to load a fatal error with clear
    information about cause
  • keeps ignoring missing pyproject.toml files as expected

With these, users of tox will not be surprised when they break the
config file by mistake, like adding a duplicate section.

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

@ssbarnea ssbarnea force-pushed the fix/msg-on-config-file-loading branch 2 times, most recently from 48979d1 to b85911f Compare August 8, 2025 14:13
@ssbarnea ssbarnea force-pushed the fix/msg-on-config-file-loading branch from 465d0fe to 1953e4f Compare August 8, 2025 16:07
@ssbarnea ssbarnea marked this pull request as ready for review August 8, 2025 16:10
@ssbarnea ssbarnea requested a review from gaborbernat as a code owner August 8, 2025 16:10
Fix bug where tox is silently ignoring loading pyproject.toml files
that failed be loaded by tomllint and falling back to other config.

- if pyproject.toml does not have one of the two expected sections
  it will be logged, so it would be visible with `-v`
- make pyproject.toml failure to load a fatal error with clear
  information about cause
- keeps ignoring missing pyproject.toml files as expected

With these, users of tox will not be surprised when they break the
config file by mistake, like adding a duplicate section.
@ssbarnea ssbarnea force-pushed the fix/msg-on-config-file-loading branch from 1953e4f to e41c1b5 Compare August 11, 2025 10:05
@ssbarnea ssbarnea requested a review from gaborbernat August 11, 2025 10:08
@gaborbernat gaborbernat merged commit 0b8f66f into main Sep 2, 2025
54 of 55 checks passed
@gaborbernat gaborbernat deleted the fix/msg-on-config-file-loading branch September 2, 2025 15:07
jsirois added a commit to jsirois/pex that referenced this pull request Sep 4, 2025
The change in tox-dev/tox#3578 causes
`tox --vrsion` to blow up when there is a setup.cfg in the CWD with no
tox:tox section.
jsirois added a commit to pex-tool/pex that referenced this pull request Sep 4, 2025
The change in tox-dev/tox#3578 causes
`tox --version` to blow up when there is a setup.cfg in the CWD with no
tox:tox section.
@Daverball
Copy link

Daverball commented Sep 4, 2025

I believe something about this change caused a regression. If you have a setup.cfg but your tox configuration resides in pyproject.toml then tox will complain about the missing tox:tox section in setup.cfg instead of using the pyproject.toml configuration.

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.

3 participants