|
22 | 22 | from test.support import force_not_colorized_test_class, SHORT_TIMEOUT
|
23 | 23 | from test.support.socket_helper import find_unused_port
|
24 | 24 | from test.support import requires_subprocess, is_emscripten
|
| 25 | +from test.support import captured_stdout, captured_stderr |
25 | 26 |
|
26 | 27 | PROCESS_VM_READV_SUPPORTED = False
|
27 | 28 |
|
@@ -416,7 +417,8 @@ def test_collapsed_stack_collector_export(self):
|
416 | 417 | collector.collect(test_frames2)
|
417 | 418 | collector.collect(test_frames3)
|
418 | 419 |
|
419 |
| - collector.export(collapsed_out.name) |
| 420 | + with (captured_stdout(), captured_stderr()): |
| 421 | + collector.export(collapsed_out.name) |
420 | 422 | # Check file contents
|
421 | 423 | with open(collapsed_out.name, "r") as f:
|
422 | 424 | content = f.read()
|
@@ -500,7 +502,8 @@ def test_flamegraph_collector_export(self):
|
500 | 502 | collector.collect(test_frames3)
|
501 | 503 |
|
502 | 504 | # Export flamegraph
|
503 |
| - collector.export(flamegraph_out.name) |
| 505 | + with (captured_stdout(), captured_stderr()): |
| 506 | + collector.export(flamegraph_out.name) |
504 | 507 |
|
505 | 508 | # Verify file was created and contains valid data
|
506 | 509 | self.assertTrue(os.path.exists(flamegraph_out.name))
|
@@ -1918,7 +1921,7 @@ def test_valid_output_formats(self):
|
1918 | 1921 | self.addCleanup(shutil.rmtree, tempdir.name)
|
1919 | 1922 |
|
1920 | 1923 |
|
1921 |
| - with contextlib.chdir(tempdir.name): |
| 1924 | + with (contextlib.chdir(tempdir.name), captured_stdout(), captured_stderr()): |
1922 | 1925 | for fmt in valid_formats:
|
1923 | 1926 | try:
|
1924 | 1927 | # This will likely fail with permissions, but the format should be valid
|
@@ -2632,6 +2635,7 @@ def test_gil_mode_collector_configuration(self):
|
2632 | 2635 | with (
|
2633 | 2636 | mock.patch("profiling.sampling.sample.SampleProfiler") as mock_profiler,
|
2634 | 2637 | mock.patch("profiling.sampling.sample.PstatsCollector") as mock_collector,
|
| 2638 | + captured_stdout(), captured_stderr() |
2635 | 2639 | ):
|
2636 | 2640 | # Mock the profiler instance
|
2637 | 2641 | mock_instance = mock.Mock()
|
|
0 commit comments