From: Daniele Varrazzo Date: Mon, 8 Mar 2021 01:41:53 +0000 (+0100) Subject: More tolerance in schedule timing tests X-Git-Tag: 3.0.dev0~87^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5db16a37a82b5c85495fa5e9ef1383a0a9b6630a;p=thirdparty%2Fpsycopg.git More tolerance in schedule timing tests --- diff --git a/tests/pool/test_sched.py b/tests/pool/test_sched.py index 3ca6cb1f0..fdd922265 100644 --- a/tests/pool/test_sched.py +++ b/tests/pool/test_sched.py @@ -24,9 +24,9 @@ def test_sched(): s.run() assert len(results) == 2 assert results[0][0] == 1 - assert results[0][1] - t0 == pytest.approx(0.1, 0.01) + assert results[0][1] - t0 == pytest.approx(0.1, 0.1) assert results[1][0] == 2 - assert results[1][1] - t0 == pytest.approx(0.2, 0.01) + assert results[1][1] - t0 == pytest.approx(0.2, 0.1) @pytest.mark.slow @@ -48,13 +48,13 @@ def test_sched_thread(): t.join() t1 = time() - assert t1 - t0 == pytest.approx(0.3, 0.01) + assert t1 - t0 == pytest.approx(0.3, 0.1) assert len(results) == 2 assert results[0][0] == 1 - assert results[0][1] - t0 == pytest.approx(0.1, 0.01) + assert results[0][1] - t0 == pytest.approx(0.1, 0.1) assert results[1][0] == 2 - assert results[1][1] - t0 == pytest.approx(0.2, 0.01) + assert results[1][1] - t0 == pytest.approx(0.2, 0.1) @pytest.mark.slow @@ -80,13 +80,13 @@ def test_sched_error(caplog): t.join() t1 = time() - assert t1 - t0 == pytest.approx(0.4, 0.01) + assert t1 - t0 == pytest.approx(0.4, 0.1) assert len(results) == 2 assert results[0][0] == 1 - assert results[0][1] - t0 == pytest.approx(0.1, 0.01) + assert results[0][1] - t0 == pytest.approx(0.1, 0.1) assert results[1][0] == 2 - assert results[1][1] - t0 == pytest.approx(0.3, 0.01) + assert results[1][1] - t0 == pytest.approx(0.3, 0.1) assert len(caplog.records) == 1 assert "ZeroDivisionError" in caplog.records[0].message @@ -116,7 +116,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.01) + assert got == pytest.approx(want, 0.1) @pytest.mark.slow @@ -145,4 +145,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.01) + assert got == pytest.approx(want, 0.1)