|
10 | 10 | import subprocess |
11 | 11 | import sys |
12 | 12 | import tempfile |
13 | | -import timeit |
14 | 13 | import unittest |
15 | 14 | from collections import namedtuple |
16 | 15 | from unittest import mock |
|
26 | 25 | from test.support import force_not_colorized_test_class, SHORT_TIMEOUT |
27 | 26 | from test.support.socket_helper import find_unused_port |
28 | 27 | from test.support import requires_subprocess, is_emscripten |
29 | | -from test.support import captured_stdout, captured_stderr |
| 28 | +from test.support import captured_stdout, captured_stderr, is_slow_machine |
30 | 29 |
|
31 | 30 | PROCESS_VM_READV_SUPPORTED = False |
32 | 31 |
|
33 | | -SLOW_MACHINE = timeit.timeit("2*2", number=10_000) > 0.0001 |
34 | | - |
35 | 32 | try: |
36 | 33 | from _remote_debugging import PROCESS_VM_READV_SUPPORTED |
37 | 34 | import _remote_debugging |
@@ -1757,7 +1754,7 @@ def main_loop(): |
1757 | 1754 | ''' |
1758 | 1755 |
|
1759 | 1756 | def test_sampling_basic_functionality(self): |
1760 | | - duration_sec = 10 if SLOW_MACHINE else 2 |
| 1757 | + duration_sec = 10 if is_slow_machine else 2 |
1761 | 1758 | with ( |
1762 | 1759 | test_subprocess(self.test_script) as subproc, |
1763 | 1760 | io.StringIO() as captured_output, |
@@ -1908,7 +1905,7 @@ def test_sample_target_script(self): |
1908 | 1905 | script_file.flush() |
1909 | 1906 | self.addCleanup(close_and_unlink, script_file) |
1910 | 1907 |
|
1911 | | - duration = 10 if SLOW_MACHINE else 1 |
| 1908 | + duration = 10 if is_slow_machine else 1 |
1912 | 1909 | test_args = [ |
1913 | 1910 | "profiling.sampling.sample", "-d", str(duration), script_file.name |
1914 | 1911 | ] |
@@ -1943,7 +1940,7 @@ def test_sample_target_module(self): |
1943 | 1940 | with open(module_path, "w") as f: |
1944 | 1941 | f.write(self.test_script) |
1945 | 1942 |
|
1946 | | - duration = 10 if SLOW_MACHINE else 1 |
| 1943 | + duration = 10 if is_slow_machine else 1 |
1947 | 1944 | test_args = [ |
1948 | 1945 | "profiling.sampling.sample", |
1949 | 1946 | "-d", str(duration), |
|
0 commit comments