Skip to content

refactor(cli) Remove redundant traceback + extract MockImporter#531

Open
tony wants to merge 2 commits intomasterfrom
refactor/cleanup-traceback-mockimporter
Open

refactor(cli) Remove redundant traceback + extract MockImporter#531
tony wants to merge 2 commits intomasterfrom
refactor/cleanup-traceback-mockimporter

Conversation

@tony
Copy link
Member

@tony tony commented Mar 1, 2026

Summary

Commit 1: Remove redundant traceback.print_exc() after log.exception()

  • log.exception() already includes the full traceback in logging output
  • Removed 11 redundant traceback.print_exc() blocks across add.py (5), discover.py (3), fmt.py (2)
  • sync.py had a different case (traceback.print_exc() after log.debug()): replaced with idiomatic log.debug(..., exc_info=True)
  • Removed unused import traceback from 3 files

Commit 2: Extract shared MockImporter to tests/cli/conftest.py

  • Moved MockImporter and CapturingMockImporter from test_import_repos.py to tests/cli/conftest.py
  • Updated test_import_repos.py to import from conftest

Test plan

  • uv run ruff check . — all checks passed
  • uv run ruff format . — no changes needed
  • uv run mypy — no issues found
  • uv run py.test -vvv — 1172 passed

tony added 2 commits March 1, 2026 16:01
why: log.exception already includes the full traceback in logging output.
what:
- Remove 11 redundant traceback.print_exc() blocks from add.py, discover.py, fmt.py
- Replace traceback.print_exc in sync.py with log.debug(exc_info=True)
- Remove unused import traceback in add.py, discover.py, fmt.py
why: MockImporter and CapturingMockImporter are test helpers that can be shared across CLI test files.
what:
- Move MockImporter and CapturingMockImporter to tests/cli/conftest.py
- Update test_import_repos.py to import from conftest
@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.03%. Comparing base (bdfaa95) to head (d78e9a2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #531      +/-   ##
==========================================
+ Coverage   83.51%   84.03%   +0.52%     
==========================================
  Files          29       29              
  Lines        3645     3620      -25     
  Branches      726      715      -11     
==========================================
- Hits         3044     3042       -2     
+ Misses        386      366      -20     
+ Partials      215      212       -3     

☔ 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.

@tony
Copy link
Member Author

tony commented Mar 1, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant