Skip to content

refactor(test[import]) Extract _run_import_defaults to reduce boilerplate#529

Open
tony wants to merge 1 commit intomasterfrom
refactor/test-import-boilerplate
Open

refactor(test[import]) Extract _run_import_defaults to reduce boilerplate#529
tony wants to merge 1 commit intomasterfrom
refactor/test-import-boilerplate

Conversation

@tony
Copy link
Member

@tony tony commented Mar 1, 2026

Summary

  • Add _run_import_defaults() wrapper with test-friendly defaults for 9 kwargs
  • Replace all 28 _run_import() call sites, keeping only kwargs that differ from defaults
  • Parameterize 3 structurally identical --sync/--prune test pairs using typing.NamedTuple

Net reduction: -208 lines (436 removed, 228 added). Test count unchanged (77 tests in file).

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 — 1173 passed

…late

why: 63+ call sites repeat identical default kwargs, obscuring test intent.
what:
- Add _run_import_defaults() helper with test-friendly defaults
- Replace all _run_import() calls with _run_import_defaults()
- Parameterize 3 structurally identical --sync/--prune test pairs
@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #529   +/-   ##
=======================================
  Coverage   83.51%   83.51%           
=======================================
  Files          29       29           
  Lines        3645     3645           
  Branches      726      726           
=======================================
  Hits         3044     3044           
  Misses        386      386           
  Partials      215      215           

☔ 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