Skip to content

Commit

Permalink
Update testcontainers version
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenchrist committed Apr 24, 2024
1 parent de63b41 commit a7826e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dev = [
"pytest-xdist",
# testcontainers 4.x have issues with Kafka on arm
# https://github.com/testcontainers/testcontainers-python/issues/450
"testcontainers<4.0",
"testcontainers~=4.4.0",
"testcontainers-minio",
"testcontainers-postgres",
"testcontainers-kafka",
Expand Down
13 changes: 6 additions & 7 deletions tests/test_test_postgres.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import os

import psycopg2
import pytest
Expand All @@ -23,11 +22,11 @@ def remove_container():
postgres.stop()

request.addfinalizer(remove_container)
os.environ["DATACONTRACT_POSTGRES_USERNAME"] = postgres.POSTGRES_USER
os.environ["DATACONTRACT_POSTGRES_PASSWORD"] = postgres.POSTGRES_PASSWORD


def test_test_postgres(postgres_container):
def test_test_postgres(postgres_container, monkeypatch):
monkeypatch.setenv("DATACONTRACT_POSTGRES_USERNAME", postgres.username)
monkeypatch.setenv("DATACONTRACT_POSTGRES_PASSWORD", postgres.password)
_init_sql()

data_contract_str = _setup_datacontract()
Expand All @@ -50,9 +49,9 @@ def _setup_datacontract():

def _init_sql():
connection = psycopg2.connect(
database=postgres.POSTGRES_DB,
user=postgres.POSTGRES_USER,
password=postgres.POSTGRES_PASSWORD,
database=postgres.dbname,
user=postgres.username,
password=postgres.password,
host=postgres.get_container_host_ip(),
port=postgres.get_exposed_port(5432),
)
Expand Down

0 comments on commit a7826e7

Please sign in to comment.