Spike: ENP testing atomic transactions #190
Labels
Dev Reviewed
Reviewed by Tech Lead
Notify
Board trigger
PM Reviewed
Reviewed by Product Manager
QA Reviewed
Reviewed by Quality Assurance
Ready For Refinement
User Story - Business Goal
User Story(ies)
As a Notify developer,
I want test database transactions to be atomic by default
So that development is not unnecessarily impeded and I don't have an aneurysm.
Additional Info and Resources
A unit test that manipulates a database generally needs to rollback its changes so they don't affect other tests. In notification-api, we do this with factory fixtures that include teardown (example) and, unfortunately often, with manual teardown in the unit test code. This is laborious and somewhat error prone.
We want to avoid manual test isolation and clean-up with ENP testing. Some web application frameworks, like Django, have built-in support for atomic testing. notification-api, which runs on Flask, used to use a pytest add-on that made tests atomic. However, we removed it because it wasn't maintained and didn't necessarily play well with pytest-xdist, which is used to run tests concurrently.
What options do we have for FastAPI?
Acceptance Criteria & Checklist
Completed research addresses the problems and/or answers the questions below:
Out of scope
Do not worry about preseeding the test database.
The text was updated successfully, but these errors were encountered: