summaryrefslogtreecommitdiff
path: root/testenv/tests
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-03-02 01:26:43 +0300
committerDevaev Maxim <[email protected]>2020-03-02 01:26:43 +0300
commit8972357dbc2147c1a02fd3470befd2b4aed9fc05 (patch)
tree63dfcdf09da43327bd48ba641a399d6ded3bb71d /testenv/tests
parente855976f05775359b774c3d5d6c3a6f6532efce6 (diff)
changed region methods to async
Diffstat (limited to 'testenv/tests')
-rw-r--r--testenv/tests/test_aiotools.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/testenv/tests/test_aiotools.py b/testenv/tests/test_aiotools.py
index 9d1c87c7..ea635e68 100644
--- a/testenv/tests/test_aiotools.py
+++ b/testenv/tests/test_aiotools.py
@@ -39,14 +39,14 @@ async def test_ok__region__access_one() -> None:
async def func() -> None:
assert not region.is_busy()
- with region:
+ async with region:
assert region.is_busy()
assert not region.is_busy()
await func()
assert not region.is_busy()
- region.exit()
+ await region.exit()
assert not region.is_busy()
@@ -56,16 +56,16 @@ async def test_fail__region__access_one() -> None:
async def func() -> None:
assert not region.is_busy()
- with region:
+ async with region:
assert region.is_busy()
- region.enter()
+ await region.enter()
assert not region.is_busy()
with pytest.raises(RegionIsBusyError):
await func()
assert not region.is_busy()
- region.exit()
+ await region.exit()
assert not region.is_busy()
@@ -75,21 +75,21 @@ async def test_ok__region__access_two() -> None:
region = AioExclusiveRegion(RegionIsBusyError)
async def func1() -> None:
- with region:
+ async with region:
await asyncio.sleep(1)
print("done func1()")
async def func2() -> None:
await asyncio.sleep(2)
print("waiking up func2()")
- with region:
+ async with region:
await asyncio.sleep(1)
print("done func2()")
await asyncio.gather(func1(), func2())
assert not region.is_busy()
- region.exit()
+ await region.exit()
assert not region.is_busy()
@@ -98,13 +98,13 @@ async def test_fail__region__access_two() -> None:
region = AioExclusiveRegion(RegionIsBusyError)
async def func1() -> None:
- with region:
+ async with region:
await asyncio.sleep(2)
print("done func1()")
async def func2() -> None:
await asyncio.sleep(1)
- with region:
+ async with region:
await asyncio.sleep(1)
print("done func2()")
@@ -113,5 +113,5 @@ async def test_fail__region__access_two() -> None:
assert type(results[1]) == RegionIsBusyError # pylint: disable=unidiomatic-typecheck
assert not region.is_busy()
- region.exit()
+ await region.exit()
assert not region.is_busy()