Skip to content

Fix tox testing - #1740

Merged
noirbizarre merged 2 commits into
commitizen-tools:v4-11-0from
noirbizarre:fix/tox
Dec 28, 2025
Merged

Fix tox testing#1740
noirbizarre merged 2 commits into
commitizen-tools:v4-11-0from
noirbizarre:fix/tox

Conversation

@noirbizarre

Copy link
Copy Markdown
Member

Description

Tox test suite (poetry test:all) is currently failing:

  • installation was KO
  • cwd was assuming to the repository in multiple tests while it's not the case in tox:
    • test data file references were root-relative
    • some test commands were only working in the root of repository

This PR fixes the tox test suite with the current stack.

The only remaining failures are those fixed in #1726 (@bearomorphism this might interest and help you testing against all versions)

Checklist

Code Changes

  • Use the testdependency-groups in tox
  • Use pytest-gitconfig instead of the git_sandbox fixture (allows safe and easy changes on gitconfig, (cf. test_git which was setting some local git config during the test)
  • Introduces 3 new fixtures (and use them when required as toxcwd is not the repository root):
    • repo_root: path to the current repository root
    • in_repo_root: change the current cwd to the repository root
    • data_dir: path to the test data

Documentation Changes

No documentation change

Expected Behavior

poetry test:all works and failure are legit broken cases.

Steps to Test This Pull Request

  1. Checkout master or v4-11-0
  2. Run poetry install --all-groups
  3. Run poetry test:all: it fails to run
  4. Checkout this branch
  5. Run poetry install --all-groups
  6. Run poetry test:all: it runs. Only failure are for 3.13 and 3.14, the cases being fixed by test(commands): centralize all --help tests in a file to dedup code #1726

Additional Context

I think this is the first PR of a "cleaning the tests" serie.
Might come after in other PRs:

  • all warning fixes (too much scrolling required to see the test results)
  • path consistency: *_path fixtures everywhere, Pathlib-based everywhere, dedup some inner conftest fixtures

@codecov

codecovBot commented Dec 28, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.84%. Comparing base (2072f8e) to head (a2b127a).
⚠️ Report is 3 commits behind head on v4-11-0.

Additional details and impacted files
@@ Coverage Diff @@## v4-11-0 #1740 +/- ##
========================================
Coverage 97.84% 97.84% ========================================
Files 60 60 Lines 2604 2604 ========================================
Hits 2548 2548 Misses 56 56 
FlagCoverage Δ
unittests97.84% <ø> (ø)

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.

@noirbizarre
noirbizarre merged commit b5636b9 into commitizen-tools:v4-11-0Dec 28, 2025
18 checks passed
@noirbizarre
noirbizarre deleted the fix/tox branch December 28, 2025 11:54
Sign up for freeto 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.

2 participants

@noirbizarre@woile