@@ -135,10 +135,6 @@ def check(_connection, _cursor, statement, _parameters, _context, _many):
135135def test_export_and_reads_leave_no_database_trace (read_catalog , tmp_path , suffix ):
136136 url , snapshot , source = read_catalog
137137 before = snapshot ()
138- if make_url (url ).get_backend_name () == "mysql" :
139- # This is the real server identity and the empty packaged registry.
140- with pytest .raises (UnsupportedOperationError ):
141- wide .initialize_wide_catalog (database_url = url )
142138 output = tmp_path / ("export" + suffix )
143139 result = openstatspec .export_sav (database_url = url , dataset_id = "sample" , destination = output )
144140 assert "operation_id" not in result
@@ -216,7 +212,11 @@ def test_dolt_reads_do_not_enable_undeclared_writes(monkeypatch):
216212 "server_version" : "2.3.0" ,
217213 }
218214 monkeypatch .setattr (capabilities , "active_connection" , lambda * _a , ** _k : active )
219- assert capabilities .read_profile (url )[0 ].name == "dolt"
215+ profile = capabilities .read_profile (url )[0 ]
216+ assert profile .name == "dolt"
217+ # A table imported under a larger explicit write envelope stays readable.
218+ from openstatspec .sql .profiles import preflight
219+ preflight (profile , 1_016 )
220220 with pytest .raises (UnsupportedOperationError ):
221221 capabilities .effective_profile (url )
222222 with pytest .raises (UnsupportedOperationError ):
@@ -228,6 +228,30 @@ def test_dolt_reads_do_not_enable_undeclared_writes(monkeypatch):
228228 )
229229
230230
231+ @pytest .mark .parametrize ("operation" , ["export" , "validate" , "capabilities" , "list" , "get" , "derived" , "dolt_state" ])
232+ @pytest .mark .parametrize ("uri" , [False , True ])
233+ def test_reads_do_not_create_a_missing_sqlite_file (tmp_path , operation , uri ):
234+ path = tmp_path / "absent.sqlite"
235+ url = f"sqlite:///file:{ path } ?uri=true" if uri else f"sqlite:///{ path } "
236+ calls = {
237+ "export" : lambda : openstatspec .export_sav (database_url = url , dataset_id = "sample" , destination = tmp_path / "out.sav" ),
238+ "validate" : lambda : openstatspec .validate (database_url = url , dataset_id = "sample" ),
239+ "capabilities" : lambda : openstatspec .capabilities (url ),
240+ "list" : lambda : openstatspec .list_datasets (database_url = url ),
241+ "get" : lambda : openstatspec .get_dataset (database_url = url , dataset_id = str (uuid4 ()), kind = "core" ),
242+ "derived" : lambda : openstatspec .validate_derived (database_url = url , derived_dataset_id = str (uuid4 ())),
243+ "dolt_state" : lambda : openstatspec .dolt_state_snapshot (database_url = url ),
244+ }
245+ with pytest .raises (UnsupportedOperationError , match = "existing SQLite" ):
246+ calls [operation ]()
247+ assert not path .exists ()
248+ assert not (tmp_path / "out.sav" ).exists ()
249+
250+
251+ def test_database_io_policy_is_explicit ():
252+ assert openstatspec .capabilities ()["database_io_policy" ] == "openstatspec-database-io-v1"
253+
254+
231255def test_derived_validation_does_not_initialize_catalog (tmp_path ):
232256 url = f"sqlite:///{ tmp_path / 'catalog.sqlite' } "
233257 openstatspec .initialize_catalog (database_url = url )
0 commit comments