run alembic in run-test.sh

This commit is contained in:
Son 2022-05-01 17:38:14 +02:00
parent e74362dd9f
commit 2de5161cd2
2 changed files with 8 additions and 4 deletions

View File

@ -1,12 +1,19 @@
# Run tests
# Delete the test DB if it isn't properly removed
docker rm -f sl-test-db
# Create a test DB
docker run -d --name sl-test-db -e POSTGRES_PASSWORD=test -e POSTGRES_USER=test -e POSTGRES_DB=test -p 15432:5432 postgres:13
# the time the DB container starts
# the time for the test DB container to start
sleep 3
# migrate the DB to the latest version
CONFIG=tests/test.env poetry run alembic upgrade head
# run test
poetry run pytest
# Delete the test DB
docker rm -f sl-test-db

View File

@ -9,7 +9,6 @@ os.environ["CONFIG"] = os.path.abspath(
import sqlalchemy
from app.db import Session, engine, connection
from app.models import Base
from psycopg2 import errors
from psycopg2.errorcodes import DEPENDENT_OBJECTS_STILL_EXIST
@ -34,8 +33,6 @@ with engine.connect() as conn:
print(">>> pg_trgm can't be dropped, ignore")
conn.execute("Rollback")
# Base.metadata.create_all(engine)
add_sl_domains()