Skip to content

Commit 2ad7c4c

Browse files
committed
tests: Deal with timeouts under macOS in Travis.
1 parent e8bb3dc commit 2ad7c4c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_pool.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
_system = platform.uname().system
1818

1919

20+
if os.environ.get('TRAVIS_OS_NAME') == 'osx':
21+
# Travis' macOS is _slow_.
22+
POOL_NOMINAL_TIMEOUT = 0.5
23+
else:
24+
POOL_NOMINAL_TIMEOUT = 0.1
25+
26+
2027
class TestPool(tb.ConnectedTestCase):
2128

2229
async def test_pool_01(self):
@@ -63,14 +70,14 @@ async def test_pool_04(self):
6370
pool = await self.create_pool(database='postgres',
6471
min_size=1, max_size=1)
6572

66-
con = await pool.acquire(timeout=0.1)
73+
con = await pool.acquire(timeout=POOL_NOMINAL_TIMEOUT)
6774
con.terminate()
6875
await pool.release(con)
6976

70-
async with pool.acquire(timeout=0.1):
77+
async with pool.acquire(timeout=POOL_NOMINAL_TIMEOUT):
7178
con.terminate()
7279

73-
con = await pool.acquire(timeout=0.1)
80+
con = await pool.acquire(timeout=POOL_NOMINAL_TIMEOUT)
7481
self.assertEqual(await con.fetchval('SELECT 1'), 1)
7582

7683
await pool.close()

0 commit comments

Comments
 (0)