diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 95479eb..ce2f80a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Tests -# Controls when the action will run. +# Controls when the action will run. on: [workflow_dispatch] jobs: @@ -23,7 +23,7 @@ jobs: env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - POSTGRES_DB: gsevpt_tests + POSTGRES_DB: gsevpt_tests # Set health checks to wait until postgres has started options: >- --health-cmd pg_isready @@ -41,5 +41,4 @@ jobs: - name: Run tests run: pytest --cov-report=html --cov=project tests/test___init__.py env: - POSTGRES_HOST: postgres - POSTGRES_PORT: 5432 + TEST_DATABASE_URL: postgresql://postgres:postgres@postgres/gsevpt_tests diff --git a/tests/conftest.py b/tests/conftest.py index 1d7246a..fd0d923 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,9 @@ from .seeder import Seeder def pytest_generate_tests(metafunc): - os.environ["DATABASE_URL"] = "postgresql://postgres@localhost/gsevpt_tests" + os.environ["DATABASE_URL"] = os.environ.get( + "TEST_DATABASE_URL", "postgresql://postgres@localhost/gsevpt_tests" + ) @pytest.fixture diff --git a/tests/test___init__.py b/tests/test___init__.py index 933386f..ac8b929 100644 --- a/tests/test___init__.py +++ b/tests/test___init__.py @@ -1,7 +1,6 @@ def test_mail_server(): import os - os.environ["DATABASE_URL"] = "postgresql://postgres@localhost/gsevpt_tests" os.environ["MAIL_SERVER"] = "mailserver.com" from project import app