@@ -20,18 +20,18 @@ def _make_connection_string(host: str, port: int, user: str, password: str, data
2020 return f"dbname={ database } user={ user } host={ host } port={ port } password={ password } "
2121
2222
23+ @pytest .fixture (scope = "session" )
24+ def xdist_postgres_isolation_level () -> XdistIsolationLevel :
25+ return "database"
26+
27+
2328@dataclasses .dataclass
2429class PostgresService (ServiceContainer ):
2530 database : str
2631 password : str
2732 user : str
2833
2934
30- @pytest .fixture (scope = "session" )
31- def xdist_postgres_isolate () -> XdistIsolationLevel :
32- return "database"
33-
34-
3535@contextmanager
3636def _provide_postgres_service (
3737 docker_service : DockerService ,
@@ -82,97 +82,97 @@ def check(_service: ServiceContainer) -> bool:
8282@pytest .fixture (autouse = False , scope = "session" )
8383def postgres_11_service (
8484 docker_service : DockerService ,
85- xdist_postgres_isolate : XdistIsolationLevel ,
85+ xdist_postgres_isolation_level : XdistIsolationLevel ,
8686) -> Generator [PostgresService , None , None ]:
8787 with _provide_postgres_service (
8888 docker_service ,
8989 image = "postgres:11" ,
9090 name = "postgres-11" ,
91- xdist_postgres_isolate = xdist_postgres_isolate ,
91+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
9292 ) as service :
9393 yield service
9494
9595
9696@pytest .fixture (autouse = False , scope = "session" )
9797def postgres_12_service (
9898 docker_service : DockerService ,
99- xdist_postgres_isolate : XdistIsolationLevel ,
99+ xdist_postgres_isolation_level : XdistIsolationLevel ,
100100) -> Generator [PostgresService , None , None ]:
101101 with _provide_postgres_service (
102102 docker_service ,
103103 image = "postgres:12" ,
104104 name = "postgres-12" ,
105- xdist_postgres_isolate = xdist_postgres_isolate ,
105+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
106106 ) as service :
107107 yield service
108108
109109
110110@pytest .fixture (autouse = False , scope = "session" )
111111def postgres_13_service (
112112 docker_service : DockerService ,
113- xdist_postgres_isolate : XdistIsolationLevel ,
113+ xdist_postgres_isolation_level : XdistIsolationLevel ,
114114) -> Generator [PostgresService , None , None ]:
115115 with _provide_postgres_service (
116116 docker_service ,
117117 image = "postgres:13" ,
118118 name = "postgres-13" ,
119- xdist_postgres_isolate = xdist_postgres_isolate ,
119+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
120120 ) as service :
121121 yield service
122122
123123
124124@pytest .fixture (autouse = False , scope = "session" )
125125def postgres_14_service (
126126 docker_service : DockerService ,
127- xdist_postgres_isolate : XdistIsolationLevel ,
127+ xdist_postgres_isolation_level : XdistIsolationLevel ,
128128) -> Generator [PostgresService , None , None ]:
129129 with _provide_postgres_service (
130130 docker_service ,
131131 image = "postgres:14" ,
132132 name = "postgres-14" ,
133- xdist_postgres_isolate = xdist_postgres_isolate ,
133+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
134134 ) as service :
135135 yield service
136136
137137
138138@pytest .fixture (autouse = False , scope = "session" )
139139def postgres_15_service (
140140 docker_service : DockerService ,
141- xdist_postgres_isolate : XdistIsolationLevel ,
141+ xdist_postgres_isolation_level : XdistIsolationLevel ,
142142) -> Generator [PostgresService , None , None ]:
143143 with _provide_postgres_service (
144144 docker_service ,
145145 image = "postgres:15" ,
146146 name = "postgres-15" ,
147- xdist_postgres_isolate = xdist_postgres_isolate ,
147+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
148148 ) as service :
149149 yield service
150150
151151
152152@pytest .fixture (autouse = False , scope = "session" )
153153def postgres_16_service (
154154 docker_service : DockerService ,
155- xdist_postgres_isolate : XdistIsolationLevel ,
155+ xdist_postgres_isolation_level : XdistIsolationLevel ,
156156) -> Generator [PostgresService , None , None ]:
157157 with _provide_postgres_service (
158158 docker_service ,
159159 image = "postgres:16" ,
160160 name = "postgres-16" ,
161- xdist_postgres_isolate = xdist_postgres_isolate ,
161+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
162162 ) as service :
163163 yield service
164164
165165
166166@pytest .fixture (autouse = False , scope = "session" )
167167def postgres_17_service (
168168 docker_service : DockerService ,
169- xdist_postgres_isolate : XdistIsolationLevel ,
169+ xdist_postgres_isolation_level : XdistIsolationLevel ,
170170) -> Generator [PostgresService , None , None ]:
171171 with _provide_postgres_service (
172172 docker_service ,
173173 image = "postgres:17" ,
174174 name = "postgres-17" ,
175- xdist_postgres_isolate = xdist_postgres_isolate ,
175+ xdist_postgres_isolate = xdist_postgres_isolation_level ,
176176 ) as service :
177177 yield service
178178
0 commit comments