You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Default generated dummy tests require database but github action provided do not run database #236
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.
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.
Add a MockedDAO layer (using unittest.mock.AsyncMock) so the dummy tests don't require a live database at all.
Update the CI workflow (github_ci/) to run the mocked tests without spinning up Postgres/MySQL services.
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!
Activity
s3rius commentedon Nov 28, 2025
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 commentedon Jul 18, 2026
Hi @s3rius 👋
I'd like to take this one. My plan:
MockedDAOlayer (usingunittest.mock.AsyncMock) so the dummy tests don't require a live database at all.github_ci/) to run the mocked tests without spinning up Postgres/MySQL services.Expected outcome:
pytestpasses 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!
fix(tests): add mocked dummy tests that run without a database