@@ -277,67 +277,6 @@ def test_record_writes_stamp(self, stamp):
277277 assert stamp .read_text ().strip () == "cu13-gnu-debug"
278278
279279
280- class TestCoverageBuildStack :
281- @pytest .mark .parametrize ("platform" , ["win32" , "linux" ])
282- @pytest .mark .parametrize ("coverage" , [False , True ])
283- @pytest .mark .agent_authored (model = "gpt-6" )
284- def test_wheel_preparation_thread_and_stack_restoration (self , monkeypatch , platform , coverage ):
285- caller = threading .current_thread ()
286- previous_stack_size = threading .stack_size ()
287- prepared = []
288- recorded = []
289-
290- def prepare (debug ):
291- prepared .append ((threading .current_thread (), debug ))
292- return "prepared-config"
293-
294- def build (wheel_directory , config_settings , metadata_directory ):
295- assert threading .current_thread () is caller
296- assert (wheel_directory , config_settings , metadata_directory ) == ("dist" , {"debug" : True }, "metadata" )
297- return "cuda_core.whl"
298-
299- monkeypatch .setattr (build_hooks , "sys" , types .SimpleNamespace (platform = platform ))
300- monkeypatch .setattr (build_hooks , "COMPILE_FOR_COVERAGE" , coverage )
301- monkeypatch .setattr (build_hooks , "_build_cuda_core" , prepare )
302- monkeypatch .setattr (build_hooks ._build_meta , "build_wheel" , build )
303- monkeypatch .setattr (build_hooks , "record_build_config" , recorded .append )
304-
305- assert build_hooks .build_wheel ("dist" , {"debug" : True }, "metadata" ) == "cuda_core.whl"
306- worker , debug = prepared [0 ]
307- assert (worker is not caller ) == (platform == "win32" and coverage )
308- assert debug is True
309- assert threading .stack_size () == previous_stack_size
310- assert recorded == ["prepared-config" ]
311-
312- @pytest .mark .agent_authored (model = "gpt-6" )
313- def test_preparation_failure_propagates_and_restores_stack (self , monkeypatch ):
314- failure = RuntimeError ("preparation failed" )
315- previous_stack_size = threading .stack_size ()
316-
317- def fail (debug ):
318- raise failure
319-
320- monkeypatch .setattr (build_hooks , "sys" , types .SimpleNamespace (platform = "win32" ))
321- monkeypatch .setattr (build_hooks , "COMPILE_FOR_COVERAGE" , True )
322- monkeypatch .setattr (build_hooks , "_build_cuda_core" , fail )
323- monkeypatch .setattr (
324- build_hooks ._build_meta ,
325- "build_wheel" ,
326- lambda * _args : pytest .fail ("failed preparation must not build a wheel" ),
327- )
328- monkeypatch .setattr (
329- build_hooks ,
330- "record_build_config" ,
331- lambda _key : pytest .fail ("failed preparation must not be stamped" ),
332- )
333-
334- with pytest .raises (RuntimeError ) as exc_info :
335- build_hooks .build_wheel ("dist" )
336-
337- assert exc_info .value is failure
338- assert threading .stack_size () == previous_stack_size
339-
340-
341280class TestBuildHookStamping :
342281 @pytest .mark .agent_authored (model = "grok-4.6" )
343282 def test_wheel_records_exact_prepared_config_after_success (self , monkeypatch ):
0 commit comments