diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 323e9d8..84eb0f3 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -11,6 +11,23 @@ jobs: runs-on: ubuntu-latest + services: + postgres: + image: postgres + + env: + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + POSTGRES_DB: postgres + + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: - name: Checkout code uses: actions/checkout@v2 diff --git a/tests/conftest.py b/tests/conftest.py index 1118f95..3549967 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -29,9 +29,9 @@ def start_application(): return app -SQLALCHEMY_DATABASE_URL = "sqlite:///./test_db.db" +SQLALCHEMY_DATABASE_URL = "postgresql://postgres:postgres@localhost:5432/postgres" engine = create_engine( - SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} + SQLALCHEMY_DATABASE_URL, echo=True, future=True ) # Use connect_args parameter only with sqlite SessionTesting = sessionmaker(autocommit=False, autoflush=False, bind=engine)