On 01/09/2022 20:00, Jonathan Vanasco wrote:
>
> > Create an empty schema from the models using create_all?
>
> This is what I usually do with smaller projects.
When taking this approach, how do you ensure the accumulated schema
migrations end up with a database that matches the one that create_all
gives you?
> When using unittest, some tests will use a fresh DB per test-run, others
> per-class, and others per-test.
Yeah, pytest fixture scoping gives a great way to set these up.
> Sometimes the tests dictate that, other
> times I control that with env vars. That gives us the flexibility to
> work on a small section and do efficient test runs during development.
Creating a database for every unit test feels like something that would
be slow enough to be annoying. How are you creating databases such that
it's fast enough for this not to be the case?
Chris