summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-04-09 08:04:36 +0300
committerDevaev Maxim <[email protected]>2019-04-09 08:04:36 +0300
commit60849efa724baa24c4a75db139944903249ae45b (patch)
treeaf68f6db838704c5f94a488411e93dac919324c9 /tests
parenta6028c46a46fc06c8865679b8c922bfcd2852ab0 (diff)
global event loop
Diffstat (limited to 'tests')
-rw-r--r--tests/test_aioregion.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/test_aioregion.py b/tests/test_aioregion.py
index 6ce717fb..601f5280 100644
--- a/tests/test_aioregion.py
+++ b/tests/test_aioregion.py
@@ -30,8 +30,7 @@ from kvmd.aioregion import AioExclusiveRegion
# =====
@pytest.mark.asyncio
-async def test_ok__access_one(event_loop: asyncio.AbstractEventLoop) -> None:
- _ = event_loop
+async def test_ok__access_one() -> None:
region = AioExclusiveRegion(RegionIsBusyError)
async def func() -> None:
@@ -48,8 +47,7 @@ async def test_ok__access_one(event_loop: asyncio.AbstractEventLoop) -> None:
@pytest.mark.asyncio
-async def test_fail__access_one(event_loop: asyncio.AbstractEventLoop) -> None:
- _ = event_loop
+async def test_fail__access_one() -> None:
region = AioExclusiveRegion(RegionIsBusyError)
async def func() -> None:
@@ -69,19 +67,19 @@ async def test_fail__access_one(event_loop: asyncio.AbstractEventLoop) -> None:
# =====
@pytest.mark.asyncio
-async def test_ok__access_two(event_loop: asyncio.AbstractEventLoop) -> None:
+async def test_ok__access_two() -> None:
region = AioExclusiveRegion(RegionIsBusyError)
async def func1() -> None:
with region:
- await asyncio.sleep(1, loop=event_loop)
+ await asyncio.sleep(1)
print("done func1()")
async def func2() -> None:
await asyncio.sleep(2)
print("waiking up func2()")
with region:
- await asyncio.sleep(1, loop=event_loop)
+ await asyncio.sleep(1)
print("done func2()")
await asyncio.gather(func1(), func2())
@@ -92,21 +90,21 @@ async def test_ok__access_two(event_loop: asyncio.AbstractEventLoop) -> None:
@pytest.mark.asyncio
-async def test_fail__access_two(event_loop: asyncio.AbstractEventLoop) -> None:
+async def test_fail__access_two() -> None:
region = AioExclusiveRegion(RegionIsBusyError)
async def func1() -> None:
with region:
- await asyncio.sleep(2, loop=event_loop)
+ await asyncio.sleep(2)
print("done func1()")
async def func2() -> None:
await asyncio.sleep(1)
with region:
- await asyncio.sleep(1, loop=event_loop)
+ await asyncio.sleep(1)
print("done func2()")
- results = await asyncio.gather(func1(), func2(), loop=event_loop, return_exceptions=True)
+ results = await asyncio.gather(func1(), func2(), return_exceptions=True)
assert results[0] is None
assert type(results[1]) == RegionIsBusyError # pylint: disable=unidiomatic-typecheck