Revert "Fix test database migration in makefile"

This reverts commit 7c4614b754.
This commit is contained in:
Antoine Bertin 2021-04-29 01:10:33 +02:00
commit 7e67434efd
No known key found for this signature in database
GPG key ID: 09851B52754E2327
2 changed files with 6 additions and 9 deletions

View file

@ -38,8 +38,6 @@ clean-test: ## remove test and coverage artifacts
rm -fr .pytest_cache
test: ## run tests quickly with the default Python
export DB_URL=sqlite:///dev/data/test.db
alembic upgrade head
poetry run pytest
format:
@ -85,4 +83,4 @@ coverage: ## check code coverage quickly with the default Python
poetry run pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html
$(BROWSER) htmlcov/index.html

View file

@ -25,16 +25,15 @@ engine = create_engine(
connect_args={"check_same_thread": False},
)
# alembic migrations (disabled as migrations happen in `make test`)
# config = config.Config("alembic.ini")
# config.set_main_option('sqlalchemy.url', DB_URL)
# config.attributes['connection'] = engine
# command.upgrade(config, "head")
# alembic migrations
config = config.Config("alembic.ini")
config.set_main_option('sqlalchemy.url', DB_URL)
config.attributes['connection'] = engine
command.upgrade(config, "head")
# test session
TestSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
def override_get_db():
try:
db = TestSessionLocal()