• 
      

    Fix unit test failures under pytest 9.

    Review Request #177 — Created Aug. 15, 2026 and updated

    Information

    Review Board
    b9ac59f...

    Reviewers

    Since the pytest pin was removed, CI installs pytest 9 on any build
    running Python 3.10 or higher (pytest 9 dropped support for older
    Python versions). Those builds were failing every test that made an
    HTTP request, while the Python 3.8 and 3.9 builds on pytest 8 passed.
    
    pytest 9 reworked fixture precedence and ordering. Our session-scoped
    autouse `setup_siteconfig` fixture used to run before `django_db_setup`,
    but under pytest 9 that order is reversed. This ended up storing
    incorrect `MEDIA_ROOT` and `STATIC_ROOT` in the database, causing
    several tests to fail because we were serving the
    manual-updates-required page instead of intended content.
    
    This makes `django_db_setup` depend on `setup_siteconfig` explicitly, so
    the paths are always configured before the siteconfig is created. That
    no longer relies on autouse fixtures being ordered first.
    
    Testing Done:
    Reproduced the fixture ordering change in isolation. pytest 8.3.5 runs
    `setup_siteconfig` first, pytest 9.1.1 runs `django_db_setup` first, and
    with this change both run in the correct order.
    
    Forced the pytest 9 ordering under pytest 8 to confirm the cause. That
    reproduced the CI failures, with the same manual updates templates being
    rendered.
    
    Reviewed at https://reviews.reviewboard.org/r/15228/