Skip to content

Default generated dummy tests require database but github action provided do not run database #236

Open

Description

@m4hi2

The project should either provide test cases with mocked DAO or run the database in GitHub Actions. I prefer providing mocked tests. This will serve as an example of how to write mocked tests.

Activity

  1. s3rius commented on Nov 28, 2025

    @s3rius
    Owner

    Mocked tests are generally a bad idea. Because you want to be sure that everything you write will run on an actual database. Sometimes databases might behave not as you would expect.

  2. AdarshJ173 commented on Jul 18, 2026

    @AdarshJ173

    Hi @s3rius 👋

    I'd like to take this one. My plan:

    1. Add a MockedDAO layer (using unittest.mock.AsyncMock) so the dummy tests don't require a live database at all.
    2. Update the CI workflow (github_ci/) to run the mocked tests without spinning up Postgres/MySQL services.
    3. Ship the mocked test files as part of the cookiecutter template so every generated project gets this out of the box.

    Expected outcome: pytest passes in a clean GitHub Actions environment with zero database dependencies for the dummy test suite, while the existing DB-backed integration tests remain opt-in.

    I'll open a draft PR shortly. Let me know if the approach needs adjusting!

  3. added a commit that references this issue on Jul 18, 2026
    8d42083
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions