Skip to content

Commit 4fd2f07

Browse files
committed
Use a two-frame stack so the export produces output
A single-frame stack yields an empty export, so the escaping was never exercised. Assert the export succeeded.
1 parent 08cc8e9 commit 4fd2f07

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/test/test_profiling/test_sampling_profiler/test_collectors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,16 @@ def test_flamegraph_escapes_special_chars_in_funcname(self):
583583
0,
584584
[MockThreadInfo(
585585
1,
586-
[MockFrameInfo("test.py", 1, '</script><b>')]
586+
[MockFrameInfo("test.py", 1, "root"),
587+
MockFrameInfo("test.py", 2, '</script><b>')]
587588
)],
588589
)
589590
]
590591
collector.collect(frames)
591592

592593
with captured_stdout(), captured_stderr():
593-
collector.export(flamegraph_out.name)
594+
export_ok = collector.export(flamegraph_out.name)
595+
self.assertTrue(export_ok)
594596

595597
with open(flamegraph_out.name, "r", encoding="utf-8") as f:
596598
content = f.read()

0 commit comments

Comments
 (0)