Skip to content

fix: run existing test suite against string-pk, UUID-pk, and no-display-field models - #231

Open
stumpylog wants to merge 1 commit into
fabiocaccamo:mainfrom
stumpylog:fix/collect-all-pk-tier-tests
Open

fix: run existing test suite against string-pk, UUID-pk, and no-display-field models#231
stumpylog wants to merge 1 commit into
fabiocaccamo:mainfrom
stumpylog:fix/collect-all-pk-tier-tests

Conversation

@stumpylog

Copy link
Copy Markdown
Contributor

Describe your changes

I wanted to explore some deeper changes, but found out not al the test suite was running. It seems at some historical point, they were missed in a refactor?

This enables the test suite to run against all four concrete models (int pk, string pk, UUID pk, no-display-field) instead of just the int-pk tier. The test count increases from 85 to 232.

Related issue
?

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests for the proposed changes.
  • I have run the tests and there are not errors.

…lay-field models

- Fix string.letters (Python 2 only) to string.ascii_letters in CategoryWithStringPk
- Add TransactionTestCase to ModelWithStringPkTestCase, ModelWithUUIDPkTestCase, and ModelWithoutDisplayFieldTestCase so they are collected by the test runner
- Add treenode_display_field to CategoryWithoutDisplayField to enable display-related tests to pass on all four model tiers

Override test_get_display and test_get_tree_display in ModelWithoutDisplayFieldTestCase
to assert the pk-fallback behavior (get_display_text() returns str(pk)) rather than the
name-based display that the other three tiers expect.

This enables the test suite to run against all four concrete models (int pk, string pk, UUID pk, no-display-field) instead of just the int-pk tier. The test count increases from 85 to 232.
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.78%. Comparing base (3d9c571) to head (666c7e6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #231      +/-   ##
==========================================
+ Coverage   95.07%   95.78%   +0.70%     
==========================================
  Files          11       11              
  Lines         711      711              
==========================================
+ Hits          676      681       +5     
+ Misses         35       30       -5     
Flag Coverage Δ
unittests 95.78% <ø> (+0.70%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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