]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Relax some timing tests tolerances
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 8 Jan 2022 22:37:55 +0000 (23:37 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 8 Jan 2022 22:38:48 +0000 (23:38 +0100)
Seeing them failing regularly in Github workflows.

tests/pool/test_sched.py
tests/pool/test_sched_async.py

index abdb97e9ed3283ac01708bb67e60bc27cba48594..b3d25723f494ef8ee3522249eab51eba4ab2ee2e 100644 (file)
@@ -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
index 6c3e23d7bcfcf08ba969129375f4d10bb1d3f32a..492d620597be4a1b76fe81a2ae7c44462a0c19f6 100644 (file)
@@ -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