• 
      

    Fix warnings about duplicate model registrations in tests.

    Review Request #14535 — Created July 30, 2025 and submitted

    Information

    Djblets
    release-6.x

    Reviewers

    Our TestModelsLoaderMixin was never 100% updated when Django added
    AppConfig, and this meant that the tear-down for test cases that define
    a tests_app wasn't quite correct. The app got properly removed from
    INSTALLED_APPS, but we were no longer removing models correctly.
    This manifested in test cases that use the djblets.integrations.tests
    app.

    The fix here involves a couple parts: the mixin has been updated to
    properly look up the app config and use its label, and a new AppConfig
    has been added for djblets.integrations.tests that defines a label so
    it doesn't just get turned into "tests".

    Ran unit tests and no longer saw ugly warnings about models already
    being registered.

    Summary ID
    Fix warnings about duplicate model registrations in tests.
    Our TestModelsLoaderMixin was never 100% updated when Django added AppConfig, and this meant that the tear-down for test cases that define a `tests_app` wasn't quite correct. The app got properly removed from `INSTALLED_APPS`, but we were no longer removing models correctly. This manifested in test cases that use the `djblets.integrations.tests` app. The fix here involves a couple parts: the mixin has been updated to properly look up the app config and use its label, and a new `AppConfig` has been added for `djblets.integrations.tests` that defines a label so it doesn't just get turned into "tests". Testing Done: Ran unit tests and no longer saw ugly warnings about models already being registered.
    28e901162cd12a419c559450e58588cf80fe1f05
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-6.x (88fec5a)