Skip to content

🐛 fix(tox-toml-fmt): keep env tables as separate sections#231

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:env-no-collapse
Feb 18, 2026
Merged

🐛 fix(tox-toml-fmt): keep env tables as separate sections#231
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:env-no-collapse

Conversation

@gaborbernat
Copy link
Member

@gaborbernat gaborbernat commented Feb 18, 2026

When using table_format = "short", the formatter was collapsing [env.NAME] sections into dotted keys under [env] (e.g. fix.description = "fix"). This triggers a RecursionError in tox's TOML config loader, which cannot handle dotted keys under the [env] table. 🐛

The fix ensures [env.*] tables are always kept as separate sections regardless of the table_format setting. When dotted keys already exist under [env], they are expanded into their own [env.NAME] sections, and any empty parent table left behind is cleaned up. Sub-tables within an environment (e.g. [env.test.sub]) still follow the table_format setting, so only the first level of environment names is protected.

This is a targeted fix — env_run_base, env_pkg_base, and all other tables continue to respect the table_format option as before.

tox has a bug where dotted keys under [env] (e.g. "3.13t".base_python)
cause a RecursionError in the config loader. The formatter was collapsing
[env.NAME] sections into dotted keys under [env] in short mode, triggering
this crash.

Environment tables are now always kept as separate [env.NAME] sections
regardless of the table_format setting. Dotted keys under [env] are
expanded into their own sections, and empty parent tables left behind
after expansion are cleaned up. Sub-tables within an environment (e.g.
[env.test.sub]) still follow the table_format setting as before.
@gaborbernat gaborbernat added the bug Something isn't working label Feb 18, 2026
@gaborbernat gaborbernat enabled auto-merge (squash) February 18, 2026 07:22
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.58%. Comparing base (e1c58d3) to head (3e81370).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #231      +/-   ##
==========================================
+ Coverage   95.61%   98.58%   +2.96%     
==========================================
  Files          19        1      -18     
  Lines        2968      212    -2756     
  Branches     2968      212    -2756     
==========================================
- Hits         2838      209    -2629     
+ Misses         63        0      -63     
+ Partials       67        3      -64     
Flag Coverage Δ
rust 98.58% <ø> (+2.96%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gaborbernat gaborbernat merged commit 4a80809 into tox-dev:main Feb 18, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments