2323 schema_simple ,
2424 schema_advanced ,
2525 schema_adapted ,
26+ schema_external ,
2627)
2728
2829
@@ -38,6 +39,20 @@ def monkeymodule():
3839 yield mp
3940
4041
42+ @pytest .fixture
43+ def enable_adapted_types (monkeypatch ):
44+ monkeypatch .setenv (ADAPTED_TYPE_SWITCH , "TRUE" )
45+ yield
46+ monkeypatch .delenv (ADAPTED_TYPE_SWITCH , raising = True )
47+
48+
49+ @pytest .fixture
50+ def enable_filepath_feature (monkeypatch ):
51+ monkeypatch .setenv (FILEPATH_FEATURE_SWITCH , "TRUE" )
52+ yield
53+ monkeypatch .delenv (FILEPATH_FEATURE_SWITCH , raising = True )
54+
55+
4156@pytest .fixture (scope = "session" )
4257def connection_root_bare ():
4358 connection = dj .Connection (
@@ -161,6 +176,24 @@ def connection_test(connection_root):
161176 connection .close ()
162177
163178
179+ @pytest .fixture (scope = "session" )
180+ def stores_config ():
181+ stores_config = {
182+ "raw" : dict (protocol = "file" , location = tempfile .mkdtemp ()),
183+ "repo" : dict (
184+ stage = tempfile .mkdtemp (), protocol = "file" , location = tempfile .mkdtemp ()
185+ ),
186+ "repo-s3" : dict (
187+ S3_CONN_INFO , protocol = "s3" , location = "dj/repo" , stage = tempfile .mkdtemp ()
188+ ),
189+ "local" : dict (protocol = "file" , location = tempfile .mkdtemp (), subfolding = (1 , 1 )),
190+ "share" : dict (
191+ S3_CONN_INFO , protocol = "s3" , location = "dj/store/repo" , subfolding = (2 , 4 )
192+ ),
193+ }
194+ return stores_config
195+
196+
164197@pytest .fixture
165198def schema_any (connection_test ):
166199 schema_any = dj .Schema (
@@ -254,6 +287,28 @@ def schema_adv(connection_test):
254287 schema .drop ()
255288
256289
290+ @pytest .fixture
291+ def schema_ext (connection_test , stores_config , enable_filepath_feature ):
292+ schema = dj .Schema (
293+ PREFIX + "_extern" ,
294+ context = schema_external .LOCALS_EXTERNAL ,
295+ connection = connection_test ,
296+ )
297+ dj .config ["stores" ] = stores_config
298+ dj .config ["cache" ] = tempfile .mkdtemp ()
299+
300+ schema (schema_external .Simple )
301+ schema (schema_external .SimpleRemote )
302+ schema (schema_external .Seed )
303+ schema (schema_external .Dimension )
304+ schema (schema_external .Image )
305+ schema (schema_external .Attach )
306+ schema (schema_external .Filepath )
307+ schema (schema_external .FilepathS3 )
308+ yield schema
309+ schema .drop ()
310+
311+
257312@pytest .fixture (scope = "session" )
258313def http_client ():
259314 # Initialize httpClient with relevant timeout.
@@ -270,6 +325,7 @@ def http_client():
270325
271326@pytest .fixture (scope = "session" )
272327def minio_client_bare (http_client ):
328+ """Initialize MinIO with an endpoint and access/secret keys."""
273329 client = minio .Minio (
274330 S3_CONN_INFO ["endpoint" ],
275331 access_key = S3_CONN_INFO ["access_key" ],
@@ -282,8 +338,8 @@ def minio_client_bare(http_client):
282338
283339@pytest .fixture (scope = "session" )
284340def minio_client (minio_client_bare ):
285- """Initialize MinIO with an endpoint and access/secret keys ."""
286- # Bootstrap MinIO bucket
341+ """Initialize a MinIO client and create buckets for testing session ."""
342+ # Setup MinIO bucket
287343 aws_region = "us-east-1"
288344 try :
289345 minio_client_bare .make_bucket (S3_CONN_INFO ["bucket" ], location = aws_region )
0 commit comments