Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 18, 2022
1 parent 45a7418 commit 3edb2a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/test_corner_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

import pytest

from aiorwlock import RWLock, _current_task
from aiorwlock import RWLock

ensure_future = asyncio.ensure_future


@contextlib.contextmanager
def should_fail(timeout, loop):
task = _current_task(loop)
task = asyncio.current_task(loop)

handle = loop.call_later(timeout, task.cancel)
try:
Expand Down
12 changes: 2 additions & 10 deletions tests/test_rwlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from aiorwlock import RWLock, _current_task
from aiorwlock import RWLock


class Bunch(object):
Expand All @@ -24,7 +24,7 @@ def __init__(self, f, n, wait_before_exit=False):
self._futures = []

async def task():
tid = _current_task()
tid = asyncio.current_task()
self.started.append(tid)
try:
await f()
Expand Down Expand Up @@ -500,14 +500,6 @@ async def coro():
assert not wl.locked


def test_current_task(loop):
with pytest.raises(RuntimeError):
_current_task(loop)

with pytest.raises(RuntimeError):
_current_task()


@pytest.mark.asyncio
async def test_read_context_manager(loop, fast_track):
rwlock = RWLock(fast=fast_track)
Expand Down

0 comments on commit 3edb2a1

Please sign in to comment.