@@ -436,30 +436,11 @@ def test_sample_profiler_keyboard_interrupt(self):
436436 @staticmethod
437437 def _fake_control_server (* , enabled = True , running = True ):
438438 """Build a minimal control_server stub for sample() integration."""
439- control = types .SimpleNamespace (
440- enabled = enabled , running = running , sample_interval_usec = 0 ,
441- )
439+ control = types .SimpleNamespace (enabled = enabled , running = running )
442440 server = mock .MagicMock ()
443441 server .control = control
444442 return server
445443
446- def test_sample_passes_interval_to_control_server (self ):
447- """Test that sample() copies its interval into control.sample_interval_usec."""
448- control_server = self ._fake_control_server (running = False )
449- with self ._patched_unwinder () as u :
450- u .instance .get_stack_trace .return_value = []
451- profiler = SampleProfiler (
452- pid = 12345 , sample_interval_usec = 4242 , all_threads = False
453- )
454- with io .StringIO () as output :
455- with mock .patch ("sys.stdout" , output ):
456- profiler .sample (
457- mock .MagicMock (),
458- duration_sec = 10 ,
459- control_server = control_server ,
460- )
461- self .assertEqual (control_server .control .sample_interval_usec , 4242 )
462-
463444 def test_sample_polls_control_server_periodically (self ):
464445 """Test that sample() drives control_server.poll() during the loop."""
465446 control_server = self ._fake_control_server ()
@@ -523,9 +504,7 @@ def test_sample_pauses_when_control_disabled(self):
523504
524505 def test_sample_resumes_after_re_enable (self ):
525506 """Test that sampling resumes when control flips from disabled to enabled."""
526- control = types .SimpleNamespace (
527- enabled = False , running = True , sample_interval_usec = 0 ,
528- )
507+ control = types .SimpleNamespace (enabled = False , running = True )
529508 control_server = mock .MagicMock ()
530509 control_server .control = control
531510
@@ -556,9 +535,7 @@ def poll_side_effect(timeout=0):
556535
557536 def test_sample_rate_reflects_enabled_time (self ):
558537 """Test that Sample rate divides by enabled time, not wall time."""
559- control = types .SimpleNamespace (
560- enabled = False , running = True , sample_interval_usec = 0 ,
561- )
538+ control = types .SimpleNamespace (enabled = False , running = True )
562539 control_server = mock .MagicMock ()
563540 control_server .control = control
564541
0 commit comments