Skip to content

Split the polymorphic field tests by layer #952

Closed

Description

@bctiemann

Proposed change

Split tests/test_polymorphic_fields.py (about 2,300 lines) by layer, into the packages that already hold each layer's tests:

  • tests/api/test_polymorphic_fields.py: PolymorphicFieldAPITest, which covers creating polymorphic fields and reading and writing their values over REST.
  • tests/test_polymorphic_views.py: PolymorphicFieldUITest, which covers the edit, bulk edit, detail and delete pages and their forms.
  • tests/models/test_polymorphic_fields.py: the model-level classes. These cover through-model registration, deleting referenced objects, cycle detection, reverse descriptors, get_models() re-entrancy and cache registry consistency.

The _grant_perm helper, used by the API and UI tests, moves to tests/base.py. Tests move unchanged.

Justification

One module mixes REST, UI and model tests, so polymorphic coverage for each layer is hard to find next to that layer's other tests. The NPL-1248 test audit proposed splitting it by layer.

Activity

  1. added this to the v1.0.0 milestone on Oct 24, 2026
  2. self-assigned this
    on Oct 24, 2026
  3. added a commit that references this issue on Oct 26, 2026
    bd39d4c
  4. added a commit that references this issue on Nov 3, 2026
    daaae81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions