Skip to content

Commit fe71587

Browse files
authored
feat: postgres paradedb extension support (#110)
1 parent 6cee154 commit fe71587

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

src/pytest_databases/docker/postgres.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,48 @@ def pgvector_connection(
476476
yield conn
477477

478478

479+
@pytest.fixture(autouse=False, scope="session")
480+
def paradedb_image() -> str:
481+
return "paradedb/paradedb:0.21.5-pg16"
482+
483+
484+
@pytest.fixture(autouse=False, scope="session")
485+
def paradedb_service(
486+
docker_service: DockerService,
487+
paradedb_image: str,
488+
xdist_postgres_isolation_level: XdistIsolationLevel,
489+
postgres_host: str,
490+
postgres_user: str,
491+
postgres_password: str,
492+
) -> Generator[PostgresService, None, None]:
493+
with _provide_postgres_service(
494+
docker_service,
495+
image=paradedb_image,
496+
name="paradedb",
497+
xdist_postgres_isolate=xdist_postgres_isolation_level,
498+
host=postgres_host,
499+
user=postgres_user,
500+
password=postgres_password,
501+
) as service:
502+
yield service
503+
504+
505+
@pytest.fixture(autouse=False, scope="session")
506+
def paradedb_connection(
507+
paradedb_service: PostgresService,
508+
) -> Generator[psycopg.Connection, None, None]:
509+
with psycopg.connect(
510+
_make_connection_string(
511+
host=paradedb_service.host,
512+
port=paradedb_service.port,
513+
user=paradedb_service.user,
514+
password=paradedb_service.password,
515+
database=paradedb_service.database,
516+
),
517+
) as conn:
518+
yield conn
519+
520+
479521
@pytest.fixture(autouse=False, scope="session")
480522
def alloydb_omni_image() -> str:
481523
return "google/alloydbomni:16"

tests/test_postgres.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"postgres_18_service",
1717
"alloydb_omni_service",
1818
"pgvector_service",
19+
"paradedb_service",
1920
],
2021
)
2122
def test_service_fixture(pytester: pytest.Pytester, service_fixture: str) -> None:
@@ -61,6 +62,7 @@ def test({service_fixture}) -> None:
6162
"postgres_18_connection",
6263
"alloydb_omni_connection",
6364
"pgvector_connection",
65+
"paradedb_connection",
6466
],
6567
)
6668
def test_startup_connection_fixture(pytester: pytest.Pytester, connection_fixture: str) -> None:

0 commit comments

Comments
 (0)