Skip to content

test: improve test coverage to 90%+#5

Merged
GeiserX merged 5 commits intomainfrom
test/improve-coverage
Apr 24, 2026
Merged

test: improve test coverage to 90%+#5
GeiserX merged 5 commits intomainfrom
test/improve-coverage

Conversation

@GeiserX
Copy link
Copy Markdown
Owner

@GeiserX GeiserX commented Apr 24, 2026

Summary

  • Expand test suite from 17 tests (22% coverage) to 269 tests (94% total coverage)
  • Add 3 new test files: test_link_traverser.py, test_report_generator.py, test_visual_comparison.py
  • Rewrite 4 existing test files with comprehensive coverage: test_cli.py, test_diff_engine.py, test_fetcher.py, test_wayback_cleaner.py
  • Fix 2 bugs found during testing:
    • diff_engine.py: compare_structures TypeError on Python 3.14 (SequenceMatcher rejects unhashable dict elements)
    • wayback_cleaner.py: remove_wayback_header fallback path skipping content past the <meta> tag boundary

Per-module coverage

Module Coverage
__init__.py 100%
cli.py 96%
diff_engine.py 97%
fetcher.py 95%
link_traverser.py 89%
report_generator.py 100%
visual_comparison.py 90%
wayback_cleaner.py 99%
TOTAL 94%

Test plan

  • All 269 tests pass locally with pytest --cov=wayback_diff
  • Total coverage 94% (target was 90%+)
  • No real network requests — all HTTP/browser interactions are mocked
  • CI pipeline confirms coverage meets codecov.yml 90% threshold

Expand test suite from 17 tests (22% coverage) to 269 tests (94% coverage).

New test files:
- test_link_traverser.py (~50 tests)
- test_report_generator.py (22 tests)
- test_visual_comparison.py (~57 tests)

Rewritten test files with comprehensive coverage:
- test_cli.py (38 tests)
- test_diff_engine.py (41 tests)
- test_fetcher.py (16 tests)
- test_wayback_cleaner.py (26 tests)

Bug fixes found during testing:
- diff_engine.py: fix compare_structures TypeError on Python 3.14
  (SequenceMatcher rejects unhashable dict elements)
- wayback_cleaner.py: fix remove_wayback_header fallback path
  skipping content past the meta tag boundary
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@GeiserX has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 38 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 8 minutes and 38 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9f103cc7-06e7-4dde-aaf2-78a777e7036e

📥 Commits

Reviewing files that changed from the base of the PR and between 5e09d17 and 6fec90a.

📒 Files selected for processing (12)
  • requirements-dev.txt
  • requirements.txt
  • tests/test_cli.py
  • tests/test_diff_engine.py
  • tests/test_fetcher.py
  • tests/test_link_traverser.py
  • tests/test_report_generator.py
  • tests/test_visual_comparison.py
  • tests/test_wayback_cleaner.py
  • wayback_diff/diff_engine.py
  • wayback_diff/visual_comparison.py
  • wayback_diff/wayback_cleaner.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/improve-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

GeiserX added 4 commits April 25, 2026 01:12
visual_comparison.py imports PIL which requires Pillow. It was in
setup.py but not in requirements.txt used by CI.
Resolves NameError when selenium is not installed by making
type annotations lazily evaluated via __future__.annotations.
Tests import selenium directly (TimeoutException, webdriver mock
targets), so it must be present in the test environment.
Tests mock ChromeDriverManager/GeckoDriverManager and import numpy
directly, so both must be present in the test environment.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@GeiserX GeiserX merged commit 75e8c51 into main Apr 24, 2026
11 checks passed
@GeiserX GeiserX deleted the test/improve-coverage branch April 24, 2026 23:25
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