@@ -3109,6 +3109,8 @@ def test_gc_frames_disabled(self):
31093109
31103110 # GC frames should NOT be present
31113111 self .assertNotIn ("<GC>" , output )
3112+
3113+
31123114@requires_subprocess ()
31133115@skip_if_not_supported
31143116class TestNativeFrameTracking (unittest .TestCase ):
@@ -3170,16 +3172,15 @@ def test_native_frames_enabled(self):
31703172 # Check file format
31713173 with open (collapsed_file .name , "r" ) as f :
31723174 content = f .read ()
3173-
3174- lines = [line .rsplit (" " , 1 )[0 ] for line in content .strip ().split ("\n " )]
3175- self .assertGreater (len (lines ), 0 )
3176-
3177- # All samples should have native code in the middle of the stack:
3178- self .assertTrue (all (";<native>;" in line for line in lines ))
3179- # Some samples should have native code at the top of the stack:
3180- self .assertTrue (any (line .endswith (";<native>" ) for line in lines ))
3181- # Some samples should have Python code at the top of the stack:
3182- self .assertTrue (any (not line .endswith (";<native>" ) for line in lines ))
3175+ lines = content .strip ().split ("\n " )
3176+ self .assertGreater (len (lines ), 0 )
3177+ stacks = [line .rsplit (" " , 1 )[0 ] for line in lines ]
3178+ # All samples should have native code in the middle of the stack:
3179+ self .assertTrue (all (";<native>;" in stack for stack in stacks ))
3180+ # Some samples should have native code at the top of the stack:
3181+ self .assertTrue (any (stack .endswith (";<native>" ) for stack in stacks ))
3182+ # Some samples should have Python code at the top of the stack:
3183+ self .assertTrue (any (not stack .endswith (";<native>" ) for stack in stacks ))
31833184
31843185 def test_native_frames_disabled (self ):
31853186 """Test that native frames do not appear when native tracking is disabled."""
@@ -3197,10 +3198,8 @@ def test_native_frames_disabled(self):
31973198 )
31983199 except PermissionError :
31993200 self .skipTest ("Insufficient permissions for remote profiling" )
3200-
32013201 output = captured_output .getvalue ()
3202-
3203- # native frames should NOT be present
3202+ # Native frames should NOT be present:
32043203 self .assertNotIn ("<native>" , output )
32053204
32063205if __name__ == "__main__" :
0 commit comments