Skip to content

Commit dcad05a

Browse files
committed
fix sampling test failure due to the _is_process_running check
Signed-off-by: Keming <kemingy94@gmail.com>
1 parent 0a1f140 commit dcad05a

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Lib/test/test_profiling/test_sampling_profiler/test_cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def test_cli_default_collapsed_filename(self):
436436

437437
with (
438438
mock.patch("sys.argv", test_args),
439-
mock.patch("profiling.sampling.sample._is_process_running", return_value=True),
439+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
440440
mock.patch("profiling.sampling.cli.sample") as mock_sample,
441441
):
442442
main()
@@ -476,7 +476,7 @@ def test_cli_custom_output_filenames(self):
476476
for test_args, expected_filename, expected_format in test_cases:
477477
with (
478478
mock.patch("sys.argv", test_args),
479-
mock.patch("profiling.sampling.sample._is_process_running", return_value=True),
479+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
480480
mock.patch("profiling.sampling.cli.sample") as mock_sample,
481481
):
482482
main()
@@ -515,7 +515,7 @@ def test_argument_parsing_basic(self):
515515

516516
with (
517517
mock.patch("sys.argv", test_args),
518-
mock.patch("profiling.sampling.sample._is_process_running", return_value=True),
518+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
519519
mock.patch("profiling.sampling.cli.sample") as mock_sample,
520520
):
521521
main()
@@ -537,7 +537,7 @@ def test_sort_options(self):
537537

538538
with (
539539
mock.patch("sys.argv", test_args),
540-
mock.patch("profiling.sampling.sample._is_process_running", return_value=True),
540+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
541541
mock.patch("profiling.sampling.cli.sample") as mock_sample,
542542
):
543543
main()
@@ -551,7 +551,7 @@ def test_async_aware_flag_defaults_to_running(self):
551551

552552
with (
553553
mock.patch("sys.argv", test_args),
554-
mock.patch("profiling.sampling.sample._is_process_running", return_value=True),
554+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
555555
mock.patch("profiling.sampling.cli.sample") as mock_sample,
556556
):
557557
main()
@@ -567,7 +567,7 @@ def test_async_aware_with_async_mode_all(self):
567567

568568
with (
569569
mock.patch("sys.argv", test_args),
570-
mock.patch("profiling.sampling.sample._is_process_running", return_value=True),
570+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
571571
mock.patch("profiling.sampling.cli.sample") as mock_sample,
572572
):
573573
main()
@@ -582,7 +582,7 @@ def test_async_aware_default_is_none(self):
582582

583583
with (
584584
mock.patch("sys.argv", test_args),
585-
mock.patch("profiling.sampling.sample._is_process_running", return_value=True),
585+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
586586
mock.patch("profiling.sampling.cli.sample") as mock_sample,
587587
):
588588
main()

Lib/test/test_profiling/test_sampling_profiler/test_modes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ def test_gil_mode_validation(self):
252252

253253
with (
254254
mock.patch("sys.argv", test_args),
255+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
255256
mock.patch("profiling.sampling.cli.sample") as mock_sample,
256257
):
257258
try:
@@ -313,6 +314,7 @@ def test_gil_mode_cli_argument_parsing(self):
313314

314315
with (
315316
mock.patch("sys.argv", test_args),
317+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
316318
mock.patch("profiling.sampling.cli.sample") as mock_sample,
317319
):
318320
try:
@@ -432,6 +434,7 @@ def test_exception_mode_validation(self):
432434

433435
with (
434436
mock.patch("sys.argv", test_args),
437+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
435438
mock.patch("profiling.sampling.cli.sample") as mock_sample,
436439
):
437440
try:
@@ -493,6 +496,7 @@ def test_exception_mode_cli_argument_parsing(self):
493496

494497
with (
495498
mock.patch("sys.argv", test_args),
499+
mock.patch("profiling.sampling.cli._is_process_running", return_value=True),
496500
mock.patch("profiling.sampling.cli.sample") as mock_sample,
497501
):
498502
try:

0 commit comments

Comments
 (0)