@@ -182,27 +182,6 @@ def postgres_17_service(
182182 yield service
183183
184184
185- @pytest .fixture (autouse = False , scope = "session" )
186- def postgres_service (postgres_17_service : PostgresService ) -> PostgresService :
187- return postgres_17_service
188-
189-
190- @pytest .fixture (autouse = False , scope = "session" )
191- def postgres_connection (
192- postgres_service : PostgresService ,
193- ) -> Generator [psycopg .Connection , None , None ]:
194- with psycopg .connect (
195- _make_connection_string (
196- host = postgres_service .host ,
197- port = postgres_service .port ,
198- user = postgres_service .user ,
199- password = postgres_service .password ,
200- database = postgres_service .database ,
201- ),
202- ) as conn :
203- yield conn
204-
205-
206185@pytest .fixture (autouse = False , scope = "session" )
207186def postgres_11_connection (
208187 postgres_11_service : PostgresService ,
@@ -313,3 +292,75 @@ def postgres_17_connection(
313292 ),
314293 ) as conn :
315294 yield conn
295+
296+
297+ @pytest .fixture (autouse = False , scope = "session" )
298+ def postgres_image () -> str :
299+ return "postgres:17"
300+
301+
302+ @pytest .fixture (autouse = False , scope = "session" )
303+ def postgres_service (
304+ docker_service : DockerService ,
305+ postgres_image : str ,
306+ xdist_postgres_isolation_level : XdistIsolationLevel ,
307+ ) -> Generator [PostgresService , None , None ]:
308+ with _provide_postgres_service (
309+ docker_service ,
310+ image = postgres_image ,
311+ name = "postgres" ,
312+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
313+ ) as service :
314+ yield service
315+
316+
317+ @pytest .fixture (autouse = False , scope = "session" )
318+ def postgres_connection (
319+ postgres_service : PostgresService ,
320+ ) -> Generator [psycopg .Connection , None , None ]:
321+ with psycopg .connect (
322+ _make_connection_string (
323+ host = postgres_service .host ,
324+ port = postgres_service .port ,
325+ user = postgres_service .user ,
326+ password = postgres_service .password ,
327+ database = postgres_service .database ,
328+ ),
329+ ) as conn :
330+ yield conn
331+
332+
333+ @pytest .fixture (autouse = False , scope = "session" )
334+ def pgvector_image () -> str :
335+ return "pgvector/pgvector:latest"
336+
337+
338+ @pytest .fixture (autouse = False , scope = "session" )
339+ def pgvector_service (
340+ docker_service : DockerService ,
341+ pgvector_image : str ,
342+ xdist_postgres_isolation_level : XdistIsolationLevel ,
343+ ) -> Generator [PostgresService , None , None ]:
344+ with _provide_postgres_service (
345+ docker_service ,
346+ image = pgvector_image ,
347+ name = "pgvector" ,
348+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
349+ ) as service :
350+ yield service
351+
352+
353+ @pytest .fixture (autouse = False , scope = "session" )
354+ def pgvector_connection (
355+ pgvector_service : PostgresService ,
356+ ) -> Generator [psycopg .Connection , None , None ]:
357+ with psycopg .connect (
358+ _make_connection_string (
359+ host = pgvector_service .host ,
360+ port = pgvector_service .port ,
361+ user = pgvector_service .user ,
362+ password = pgvector_service .password ,
363+ database = pgvector_service .database ,
364+ ),
365+ ) as conn :
366+ yield conn
0 commit comments