Skip to content

Revival/coverage and bugs - #26

Merged
angvp merged 2 commits into
masterfrom
revival/coverage-and-bugs
Jul 5, 2026
Merged

angvp merged 2 commits into
masterfrom
revival/coverage-and-bugs

Conversation

@angvp

@angvp angvp commented Jul 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Fix cache/slug edge cases found in code review: slug translations no longer get clobbered by unrelated field updates, unsaved instances no longer leak cache values between each other, unsaved-instance errors are now CanNotTranslate instead of raw IntegrityError, and translatable_fields as a list is no longer mutated in place.
  • Make CI's coverage gate fail visibly instead of hiding inside XML generation; make coverage no longer aborts before generating the HTML report.
  • Migrate the test suite (45 tests) from unittest.TestCase to pytest-native functions and fixtures, cutting ~15 duplicated setUp/tearDown blocks.
  • Ignore uv.lock — this is a library tested across a Django/Python matrix, so a single locked resolution isn't representative.

Test plan

  • pytest tests/ -v — 45/45 passing
  • pytest tests/ --cov=klingon — 100% coverage
  • ruff check klingon tests — clean
  • Verified against Django 4.2, 5.2, 6.0

angvp added 2 commits July 5, 2026 08:31
Explicit slug translations now survive unrelated field updates (gate was
keying on "not the slug" instead of "is the slug's source field");
translations_link() uses pk not id; unsaved instances no longer leak
cache values across each other; get_translation_obj() raises
CanNotTranslate instead of a raw IntegrityError; list-typed
translatable_fields can no longer be mutated in place. CI's coverage
gate now fails on a clearly-named step instead of inside XML generation,
make coverage no longer aborts before generating the HTML report, and
HISTORY.md's cache-invalidation claim is corrected. 45/45 tests, 100%
coverage, verified on Django 4.2/5.2/6.0.

Signed-off-by: Angel Velasquez <me@angvp.com>
…tions

Converts all 45 tests across 6 files to pytest functions with shared
fixtures (book, library, cache cleanup), removing setUp/tearDown
boilerplate duplicated across ~15 TestCase classes. Adopts idiomatic
pytest patterns (pytest.raises, monkeypatch, django_assert_num_queries)
in place of unittest assertion methods and mock.patch.

Also ignores uv.lock: as a library tested across a Python/Django
version matrix, a single locked resolution doesn't reflect how the
package is actually consumed or CI-tested.

Signed-off-by: Angel Velasquez <me@angvp.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a080fb9) to head (d11d4b1).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #26   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          194       199    +5     
=========================================
+ Hits           194       199    +5     

☔ View full report in Codecov by Harness.
📢 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.

@angvp
angvp merged commit f77ebc2 into master Jul 5, 2026
16 checks passed
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.

2 participants