Skip to content

Commit 942d821

Browse files
committed
s/collapsed_out/jsonl_out/, less copying :D
1 parent 350ad99 commit 942d821

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

Lib/test/test_profiling/test_sampling_profiler/test_collectors.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,8 +1667,8 @@ def test_diff_flamegraph_load_baseline(self):
16671667
self.assertAlmostEqual(cold_node["diff_pct"], -50.0)
16681668

16691669
def test_jsonl_collector_export(self):
1670-
collapsed_out = tempfile.NamedTemporaryFile(delete=False)
1671-
self.addCleanup(close_and_unlink, collapsed_out)
1670+
jsonl_out = tempfile.NamedTemporaryFile(delete=False)
1671+
self.addCleanup(close_and_unlink, jsonl_out)
16721672

16731673
collector = JsonlCollector(1000)
16741674
run_id = collector.run_id
@@ -1706,10 +1706,10 @@ def test_jsonl_collector_export(self):
17061706
collector.collect(test_frames3)
17071707

17081708
with captured_stdout(), captured_stderr():
1709-
collector.export(collapsed_out.name)
1709+
collector.export(jsonl_out.name)
17101710

17111711
# Check file contents
1712-
with open(collapsed_out.name, "r") as f:
1712+
with open(jsonl_out.name, "r") as f:
17131713
content = f.read()
17141714

17151715
lines = content.strip().split("\n")
@@ -2147,8 +2147,8 @@ def test_gecko_collector_with_location_info(self):
21472147

21482148
def test_jsonl_collector_with_location_info(self):
21492149
"""Test JsonlCollector handles LocationInfo properly."""
2150-
collapsed_out = tempfile.NamedTemporaryFile(delete=False)
2151-
self.addCleanup(close_and_unlink, collapsed_out)
2150+
jsonl_out = tempfile.NamedTemporaryFile(delete=False)
2151+
self.addCleanup(close_and_unlink, jsonl_out)
21522152

21532153
collector = JsonlCollector(sample_interval_usec=1000)
21542154
run_id = collector.run_id
@@ -2164,10 +2164,10 @@ def test_jsonl_collector_with_location_info(self):
21642164

21652165
# Should extract lineno from location
21662166
with captured_stdout(), captured_stderr():
2167-
collector.export(collapsed_out.name)
2167+
collector.export(jsonl_out.name)
21682168

21692169
# Check file contents
2170-
with open(collapsed_out.name, "r") as f:
2170+
with open(jsonl_out.name, "r") as f:
21712171
content = f.read()
21722172

21732173
lines = content.strip().split("\n")
@@ -2197,8 +2197,8 @@ def jsonl(obj):
21972197

21982198
def test_jsonl_collector_with_none_location(self):
21992199
"""Test JsonlCollector handles None location (synthetic frames)."""
2200-
collapsed_out = tempfile.NamedTemporaryFile(delete=False)
2201-
self.addCleanup(close_and_unlink, collapsed_out)
2200+
jsonl_out = tempfile.NamedTemporaryFile(delete=False)
2201+
self.addCleanup(close_and_unlink, jsonl_out)
22022202

22032203
collector = JsonlCollector(sample_interval_usec=1000)
22042204
run_id = collector.run_id
@@ -2216,10 +2216,10 @@ def test_jsonl_collector_with_none_location(self):
22162216

22172217
# Should handle None location as synthetic frame
22182218
with captured_stdout(), captured_stderr():
2219-
collector.export(collapsed_out.name)
2219+
collector.export(jsonl_out.name)
22202220

22212221
# Check file contents
2222-
with open(collapsed_out.name, "r") as f:
2222+
with open(jsonl_out.name, "r") as f:
22232223
content = f.read()
22242224

22252225
lines = content.strip().split("\n")

Lib/test/test_profiling/test_sampling_profiler/test_modes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ def test_jsonl_collector_rspects_skip_idle(self):
238238
import tempfile
239239
import json
240240

241-
collapsed_out = tempfile.NamedTemporaryFile(delete=False)
242-
self.addCleanup(close_and_unlink, collapsed_out)
241+
jsonl_out = tempfile.NamedTemporaryFile(delete=False)
242+
self.addCleanup(close_and_unlink, jsonl_out)
243243

244244
# Create mock frames with different thread statuses
245245
class MockThreadInfoWithStatus:
@@ -287,10 +287,10 @@ def __init__(self, thread_id, frame_info, status):
287287

288288
# Should only have functions from running threads (status 0)
289289
with captured_stdout(), captured_stderr():
290-
collector_skip.export(collapsed_out.name)
290+
collector_skip.export(jsonl_out.name)
291291

292292
# Check file contents
293-
with open(collapsed_out.name, "r") as f:
293+
with open(jsonl_out.name, "r") as f:
294294
content = f.read()
295295

296296
lines = content.strip().split("\n")
@@ -333,10 +333,10 @@ def jsonl(obj):
333333

334334
# Should have functions from all threads
335335
with captured_stdout(), captured_stderr():
336-
collector_no_skip.export(collapsed_out.name)
336+
collector_no_skip.export(jsonl_out.name)
337337

338338
# Check file contents
339-
with open(collapsed_out.name, "r") as f:
339+
with open(jsonl_out.name, "r") as f:
340340
content = f.read()
341341

342342
lines = content.strip().split("\n")

0 commit comments

Comments
 (0)