-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: remove pytest-env * fix: tests must use test settings instead of environment variables * docs: add release changes
- Loading branch information
Showing
14 changed files
with
68 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
set -e | ||
set -x | ||
|
||
pytest -m "db" ${@} | ||
APP_ENV=test pytest -m "db" ${@} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
import warnings | ||
from os import environ | ||
|
||
import pytest | ||
from sqlalchemy import create_engine | ||
|
||
from app.db.sqlalchemy import Base, make_url_sync | ||
from app.settings.environments.test import TestAppSettings | ||
|
||
|
||
@pytest.fixture | ||
def migrations(printer): | ||
def migrations(printer, settings: TestAppSettings): | ||
import app.db.models # isort: skip | ||
|
||
warnings.filterwarnings("ignore", category=ResourceWarning) | ||
dsn = environ.get("TEST_DB_CONNECTION") | ||
if dsn: | ||
printer(f"Using database {dsn}") | ||
engine = create_engine(make_url_sync(dsn)) | ||
Base.metadata.create_all(engine) | ||
yield | ||
Base.metadata.drop_all(engine) | ||
else: | ||
yield | ||
dsn = settings.DATABASE_URL | ||
printer(f"Using database {dsn}") | ||
|
||
engine = create_engine(make_url_sync(dsn)) | ||
Base.metadata.create_all(engine) | ||
yield | ||
Base.metadata.drop_all(engine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters