From e225d9a894d70c5a27632eccd03ce11f28d2b27a Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 20 Dec 2020 19:33:06 +0000 Subject: [PATCH] test:allow slower asyncio if platform=="darwin" --- tests/py37_asyncio.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/py37_asyncio.py b/tests/py37_asyncio.py index 7b565a4b..b82eff6d 100644 --- a/tests/py37_asyncio.py +++ b/tests/py37_asyncio.py @@ -1,4 +1,5 @@ from functools import partial +from sys import platform from time import time import asyncio @@ -96,7 +97,8 @@ async def test_coroutines(): @mark.asyncio -async def test_as_completed(capsys): +@mark.parametrize("tol", [0.2 if platform.startswith("darwin") else 0.1]) +async def test_as_completed(capsys, tol): """Test asyncio as_completed""" for retry in range(3): t = time() @@ -105,7 +107,7 @@ async def test_as_completed(capsys): await i t = time() - t - 2 * skew try: - assert 0.27 < t < 0.33, t + assert 0.3 * (1 - tol) < t < 0.3 * (1 + tol), t _, err = capsys.readouterr() assert '30/30' in err except AssertionError: