diff --git a/tests/test_cancellation.py b/tests/test_cancellation.py index 6b0aee90..a5ed368a 100644 --- a/tests/test_cancellation.py +++ b/tests/test_cancellation.py @@ -788,7 +788,7 @@ def test_cancel_via_SIGINT_other_task( started from a seperate ``trio`` child task. ''' - from .conftest import cpu_scaling_factor + from .conftest import cpu_perf_headroom pid: int = os.getpid() timeout: float = ( @@ -798,8 +798,9 @@ def test_cancel_via_SIGINT_other_task( if _friggin_windows: # smh timeout += 1 - # add latency headroom for CPU freq scaling (auto-cpufreq et al.) - headroom: float = cpu_scaling_factor() + # latency headroom for static cpu-freq scaling + sustained-load + # throttle + CI (auto-cpufreq et al.); see `cpu_perf_headroom()`. + headroom: float = cpu_perf_headroom() if headroom != 1.: timeout *= headroom @@ -995,11 +996,11 @@ def test_fast_graceful_cancel_when_spawn_task_in_soft_proc_wait_for_daemon( if _friggin_windows: # smh timeout += 1 - # CPU-scaling / CI latency headroom — macOS CI especially is - # slow for this graceful-vs-hard-reap timing race; see - # `cpu_scaling_factor()`. - from .conftest import cpu_scaling_factor - timeout *= cpu_scaling_factor() + # CPU-scaling / sustained-throttle / CI latency headroom — macOS + # CI especially is slow for this graceful-vs-hard-reap timing + # race; see `cpu_perf_headroom()`. + from .conftest import cpu_perf_headroom + timeout *= cpu_perf_headroom() async def main(): start = time.time() diff --git a/tests/test_legacy_one_way_streaming.py b/tests/test_legacy_one_way_streaming.py index 648ba1b8..ade76763 100644 --- a/tests/test_legacy_one_way_streaming.py +++ b/tests/test_legacy_one_way_streaming.py @@ -326,11 +326,11 @@ def time_quad_ex( ): timeout += 1 - # inflate the cancel-deadline for CPU-freq scaling AND/OR CI - # latency (see `cpu_scaling_factor()`) so the example isn't - # cancelled mid-stream on a throttled/CI runner. - from .conftest import cpu_scaling_factor - timeout *= cpu_scaling_factor() + # inflate the cancel-deadline for static cpu-freq scaling + + # sustained-load throttle + CI latency (see `cpu_perf_headroom()`) + # so the example isn't cancelled mid-stream on a throttled/CI box. + from .conftest import cpu_perf_headroom + timeout *= cpu_perf_headroom() start: float = time.time() results: list[int] = trio.run(partial( @@ -379,8 +379,8 @@ def test_a_quadruple_example( # https://github.com/AdnanHodzic/auto-cpufreq?tab=readme-ov-file#example-config-file-contents # # HENCE this below latency-headroom compensation logic.. - from .conftest import cpu_scaling_factor - headroom: float = cpu_scaling_factor() + from .conftest import cpu_perf_headroom + headroom: float = cpu_perf_headroom() if headroom != 1.: this_fast = this_fast_on_linux * headroom test_log.warning(