From ba6a7dbab8457dd20bb05ad0330d9109aef85c9b Mon Sep 17 00:00:00 2001 From: Giorgis Georgakoudis Date: Sun, 27 Sep 2026 11:44:19 -0700 Subject: [PATCH] test: make test_omp_get_wtime deterministic The busy-wait asserted elapsed time within 5 ms (places=2). CI runner preemption past the deadline failed the macOS job intermittently. Timing accuracy belongs to libomp, not PyOMP. Keep binding coverage: omp_get_wtime is the only float64-returning _OpenmpExternalFunction, so the test checks a positive float from both njit and interpreted calls. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/numba/openmp/tests/test_openmp.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/numba/openmp/tests/test_openmp.py b/src/numba/openmp/tests/test_openmp.py index c3aee25fa37c..4e0e0425b60f 100644 --- a/src/numba/openmp/tests/test_openmp.py +++ b/src/numba/openmp/tests/test_openmp.py @@ -4775,21 +4775,13 @@ def test_impl(): def test_omp_get_wtime(self): @njit - def test_impl(t): - start = omp_get_wtime() - while start + t > omp_get_wtime(): - continue - return omp_get_wtime() - start - - t = 0.25 - delay = test_impl(t) - self.assertAlmostEqual(delay, t, places=2) - - start = omp_get_wtime() - while start + t > omp_get_wtime(): - continue - delay = omp_get_wtime() - start - self.assertAlmostEqual(delay, t, places=2) + def test_impl(): + return omp_get_wtime() + + for wtime in (test_impl, omp_get_wtime): + t = wtime() + self.assertIsInstance(t, float) + self.assertGreater(t, 0.0) @linux_only def test_omp_get_num_devices(self):