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

#236 · open · 2 comments

View on GitHub ↗

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.

Comments

s3rius

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.

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!