Add database migrations
- use Alembic to migrate the PostgreSQL database
+ create initial migration script to set up the database,
as an alternative to db.Base.metadata.create_all()
+ integrate Alembic into the test suite; the db_engine fixture
now has two modes:
* create the latest version of tables all at once
* invoke `alembic upgrade head`
=> the "e2e" tests are all run twice, once in each mode; this
ensures that the migration scripts re-create the same database
schema as db.Base.metadata.create_all() would
* in both modes, a temporary PostgreSQL schema is used to create the
tables in
=> could now run "e2e" tests against production database and still
have isolation
- make the configuration module public (to be used by Alembic)
- adjust linting rules for Alembic
This commit is contained in:
parent
fdcc93a1ea
commit
a16c260543
14 changed files with 1104 additions and 35 deletions
18
setup.cfg
18
setup.cfg
|
|
@ -102,6 +102,20 @@ per-file-ignores =
|
|||
docs/conf.py:
|
||||
# Allow shadowing built-ins and reading __*__ variables.
|
||||
WPS125,WPS609,
|
||||
migrations/env.py:
|
||||
# Type annotations are not strictly enforced.
|
||||
ANN0, ANN2,
|
||||
migrations/versions/*.py:
|
||||
# Type annotations are not strictly enforced.
|
||||
ANN0, ANN2,
|
||||
# File names of revisions are ok.
|
||||
WPS114,WPS118,
|
||||
# Revisions may have too many expressions.
|
||||
WPS204,WPS213,
|
||||
# No overuse of string constants (e.g., 'RESTRICT').
|
||||
WPS226,
|
||||
# Too many noqa's are ok.
|
||||
WPS402,
|
||||
noxfile.py:
|
||||
# Type annotations are not strictly enforced.
|
||||
ANN0, ANN2,
|
||||
|
|
@ -111,7 +125,7 @@ per-file-ignores =
|
|||
WPS213,
|
||||
# No overuse of string constants (e.g., '--version').
|
||||
WPS226,
|
||||
src/urban_meal_delivery/_config.py:
|
||||
src/urban_meal_delivery/configuration.py:
|
||||
# Allow upper case class variables within classes.
|
||||
WPS115,
|
||||
# Numbers are normal in config files.
|
||||
|
|
@ -255,5 +269,7 @@ addopts =
|
|||
--strict-markers
|
||||
cache_dir = .cache/pytest
|
||||
console_output_style = count
|
||||
env =
|
||||
TESTING=true
|
||||
markers =
|
||||
e2e: integration tests, inlc., for example, tests touching a database
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue