22
33from __future__ import annotations
44
5- import pickle
65import random
76from collections import Counter
87from dataclasses import replace
2322from sqlbuild .compiler .frontier .constants import COMPILER_ENGINE_ENV_VAR
2423from sqlbuild .compiler .frontier .types import CompilerEngine
2524from sqlbuild .compiler .sql_analysis .constants import ANALYSIS_RECORD_DIR_ENV_VAR
26- from sqlbuild .rule_engine ._helpers .engine .custom_rules import host_project
27- from sqlbuild .rule_engine ._helpers .host .custom_host_pool import host_payload_project
2825from tests .integration .src .sqlbuild .compiler .analysis_session ._test_types import (
2926 AnalysisFallbackTestCase ,
3027 GeneratedAnalysisParityTestCase ,
31- HostPayloadTestCase ,
3228 SessionFailureTestCase ,
3329 StandalonePivotProofTestCase ,
3430)
@@ -204,7 +200,7 @@ def test_given_session_failure_after_deferrals_when_analysing_then_records_only_
204200 description = "a selection that leaves the pivots out of model analysis" ,
205201 analysed_models = frozenset ({"orders_list" }),
206202 expected_native_proofs = 2 ,
207- expected_session_answers = [ True , True ] ,
203+ expected_session_proofs = 2 ,
208204 expected_proven_by_model = {
209205 "orders_list" : None ,
210206 "status_amounts" : True ,
@@ -215,7 +211,7 @@ def test_given_session_failure_after_deferrals_when_analysing_then_records_only_
215211 description = "no model analysis, so the proofs run without a session" ,
216212 analysed_models = frozenset (),
217213 expected_native_proofs = 2 ,
218- expected_session_answers = [ False , False ] ,
214+ expected_session_proofs = 0 ,
219215 expected_proven_by_model = {
220216 "orders_list" : None ,
221217 "status_amounts" : True ,
@@ -243,50 +239,18 @@ def test_given_unanalysed_pivot_model_when_assembling_then_native_proves_it_with
243239 assert (
244240 all (proof is not None for proof in recorded .proofs ),
245241 len (recorded .proofs ),
246- recorded .session_answers ,
242+ recorded .session_proofs ,
247243 {
248244 model .name : getattr (model .dynamic_column_contract , "output_proven" , None )
249245 for model in project .models
250246 },
251247 ) == (
252248 True ,
253249 test_case .expected_native_proofs ,
254- test_case .expected_session_answers ,
250+ test_case .expected_session_proofs ,
255251 test_case .expected_proven_by_model ,
256252 )
257253
258254
259- @pytest .mark .parametrize (
260- "test_case" ,
261- [
262- HostPayloadTestCase (
263- description = "a pivot project analysed in one native session" ,
264- expected_models = ("orders_list" , "status_amounts" , "status_passthrough" ),
265- )
266- ],
267- ids = lambda case : case .description ,
268- )
269- def test_given_native_session_when_publishing_rule_host_payload_then_session_is_dropped (
270- test_case : HostPayloadTestCase , tmp_path : Path , monkeypatch : pytest .MonkeyPatch
271- ) -> None :
272- inputs : CompileProjectInputs = compile_inputs (
273- project_dir = tmp_path / "project" , files = pivot_project_files ()
274- )
275- monkeypatch .setenv (COMPILER_ENGINE_ENV_VAR , CompilerEngine .NATIVE_PREVIEW .value )
276- project : CompiledProject = assemble_compiled_project (
277- inputs = inputs , inference_profile = ExpressionInferenceProfile (sql_analysis_dialect = "duckdb" )
278- )
279-
280- payload : CompiledProject = pickle .loads (
281- pickle .dumps (host_payload_project (host_project (project )))
282- )
283-
284- assert project .native_session is not None
285- assert (payload .native_session , tuple (sorted (model .name for model in payload .models ))) == (
286- None ,
287- test_case .expected_models ,
288- )
289-
290-
291255if __name__ == "__main__" :
292256 pytest .main ([__file__ , "-vv" ])
0 commit comments