From: Daniele Varrazzo Date: Sat, 8 Jan 2022 22:37:55 +0000 (+0100) Subject: Relax some timing tests tolerances X-Git-Tag: pool-3.1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d885b22775c8196d429dc7e2a473b469fdfb566;p=thirdparty%2Fpsycopg.git Relax some timing tests tolerances Seeing them failing regularly in Github workflows. --- diff --git a/tests/pool/test_sched.py b/tests/pool/test_sched.py index abdb97e9e..b3d25723f 100644 --- a/tests/pool/test_sched.py +++ b/tests/pool/test_sched.py @@ -54,13 +54,13 @@ def test_sched_thread(): t.join() t1 = time() - assert t1 - t0 == pytest.approx(0.3, 0.1) + assert t1 - t0 == pytest.approx(0.3, 0.2) assert len(results) == 2 assert results[0][0] == 1 - assert results[0][1] - t0 == pytest.approx(0.1, 0.1) + assert results[0][1] - t0 == pytest.approx(0.1, 0.2) assert results[1][0] == 2 - assert results[1][1] - t0 == pytest.approx(0.2, 0.1) + assert results[1][1] - t0 == pytest.approx(0.2, 0.2) @pytest.mark.slow @@ -122,7 +122,7 @@ def test_empty_queue_timeout(): t.join() times.append(time() - t0) for got, want in zip(times, [0.2, 0.4, 0.5, 1.0]): - assert got == pytest.approx(want, 0.1) + assert got == pytest.approx(want, 0.2), times @pytest.mark.slow @@ -151,4 +151,4 @@ def test_first_task_rescheduling(): t.join() times.append(time() - t0) for got, want in zip(times, [0.1, 0.2, 0.4, 0.6, 0.6]): - assert got == pytest.approx(want, 0.1) + assert got == pytest.approx(want, 0.2), times diff --git a/tests/pool/test_sched_async.py b/tests/pool/test_sched_async.py index 6c3e23d7b..492d62059 100644 --- a/tests/pool/test_sched_async.py +++ b/tests/pool/test_sched_async.py @@ -55,13 +55,13 @@ async def test_sched_task(): await asyncio.gather(t) t1 = time() - assert t1 - t0 == pytest.approx(0.3, 0.1) + assert t1 - t0 == pytest.approx(0.3, 0.2) assert len(results) == 2 assert results[0][0] == 1 - assert results[0][1] - t0 == pytest.approx(0.1, 0.1) + assert results[0][1] - t0 == pytest.approx(0.1, 0.2) assert results[1][0] == 2 - assert results[1][1] - t0 == pytest.approx(0.2, 0.1) + assert results[1][1] - t0 == pytest.approx(0.2, 0.2) @pytest.mark.slow @@ -123,7 +123,7 @@ async def test_empty_queue_timeout(): await asyncio.gather(t) times.append(time() - t0) for got, want in zip(times, [0.2, 0.4, 0.5, 1.0]): - assert got == pytest.approx(want, 0.1), times + assert got == pytest.approx(want, 0.2), times @pytest.mark.slow @@ -156,4 +156,4 @@ async def test_first_task_rescheduling(): await asyncio.gather(t) times.append(time() - t0) for got, want in zip(times, [0.1, 0.2, 0.4, 0.6, 0.6]): - assert got == pytest.approx(want, 0.1), times + assert got == pytest.approx(want, 0.2), times