|
9 | 9 | import socket |
10 | 10 | import subprocess |
11 | 11 | import sys |
| 12 | +import timeit |
12 | 13 | import tempfile |
13 | 14 | import unittest |
14 | 15 | from collections import namedtuple |
|
29 | 30 |
|
30 | 31 | PROCESS_VM_READV_SUPPORTED = False |
31 | 32 |
|
| 33 | +SLOW_MACHINE = timeit.timeit("2*2", number=10_000) > 0.0001 |
| 34 | + |
32 | 35 | try: |
33 | 36 | from _remote_debugging import PROCESS_VM_READV_SUPPORTED |
34 | 37 | import _remote_debugging |
@@ -1904,7 +1907,10 @@ def test_sample_target_script(self): |
1904 | 1907 | script_file.flush() |
1905 | 1908 | self.addCleanup(close_and_unlink, script_file) |
1906 | 1909 |
|
1907 | | - test_args = ["profiling.sampling.sample", "-d", "1", script_file.name] |
| 1910 | + duration = 2 if SLOW_MACHINE else 1 |
| 1911 | + test_args = [ |
| 1912 | + "profiling.sampling.sample", "-d", str(duration), script_file.name |
| 1913 | + ] |
1908 | 1914 |
|
1909 | 1915 | with ( |
1910 | 1916 | mock.patch("sys.argv", test_args), |
@@ -1936,7 +1942,12 @@ def test_sample_target_module(self): |
1936 | 1942 | with open(module_path, "w") as f: |
1937 | 1943 | f.write(self.test_script) |
1938 | 1944 |
|
1939 | | - test_args = ["profiling.sampling.sample", "-d", "1", "-m", "test_module"] |
| 1945 | + duration = 2 if SLOW_MACHINE else 1 |
| 1946 | + test_args = [ |
| 1947 | + "profiling.sampling.sample", |
| 1948 | + "-d", str(duration), |
| 1949 | + "-m", "test_module" |
| 1950 | + ] |
1940 | 1951 |
|
1941 | 1952 | with ( |
1942 | 1953 | mock.patch("sys.argv", test_args), |
|
0 commit comments