Skip to content

add test fixtures for database-backed tests #577

In review

Description

@MoralCode

Several areas of the app could use unit testing that is backed by a database fixture:

  • testing the materialized view comparator to make sure things work for alembic migrations
  • testing the startup behavior to make sure the DB is correctly populated

We should have test fixtures in pytest that can provide database sessions for the tests that need them, even if its just a blank DB.

some work has already started in the respective PRs for the above things, but having a unified/reusable system for it would be nice

Activity

  1. added
    help wanted
    database
    devops
    testing
    on Nov 17, 2026
  2. MoralCode commented on Nov 17, 2026

    @MoralCode
    ContributorAuthor

    In terms of nice to haves, I would like this To:

    • Be able to skip running the database backtest when there is no database URL provided (which can be done with https://docs.pytest.org/en/stable/reference/reference.html#pytest.mark.skipif
    • ideally also be marked so they can run
    • be run in CI (can use service containers)
    • be able to run locally (a new docker compose/env setup is ok)
    • ideally it would be awesome if each test, at least the ones needing blank schemas/creating their own could define their own schemas to use to avoid conflict (espeif cleanup can be automatic)
    • future: tests requiring the full valid schema can choose that too (Maybe this requires multiple databases because CollectOSS is a multi-schema app, Or maybe just the blank schemas can fit in between the CollectOSS ones)
  3. added 3 commits that reference this issue on Nov 21, 2026
    48e6d90
    8a3fd64
    505ab5e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    databasedevopshelp wantedtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions