tokio icon indicating copy to clipboard operation
tokio copied to clipboard

Test tokio with other libraries

Open jettify opened this issue 8 years ago • 10 comments

  • https://github.com/aio-libs/aiorwlock/pull/35 passes
  • https://github.com/aio-libs/aiomonitor/pull/41 fails

jettify avatar May 10 '17 20:05 jettify

Awesome! Thanks!

Will check aiomonitor.

On May 10, 2017, at 1:29 PM, Nikolay Novik [email protected] wrote:

aio-libs/aiorwlock#35 https://github.com/aio-libs/aiorwlock/pull/35 passes aio-libs/aiomonitor#41 https://github.com/aio-libs/aiomonitor/pull/41 fails — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PyO3/tokio/issues/34, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkjzmV0pbWDiXZ2SoXrmNlalxlZJv2jks5r4h5CgaJpZM4NXLr-.

fafhrd91 avatar May 10 '17 20:05 fafhrd91

With tokio loop I am getting bunch of errors RuntimeError: Timeout context manager should be used inside a task when using loop.run_until_complete(coro) as result tests does not have a chance to start since such idiom ofter used in test fixtures. (asyncio and uvloop works as expected)

    @pytest.fixture
    def bucket_name(region, create_bucket, s3_client, loop):
>       name = loop.run_until_complete(create_bucket(region))
E       RuntimeError: Timeout context manager should be used inside a task

jettify avatar May 10 '17 20:05 jettify

This is because Task.current_task() does not work with tokio loop. Yury Selivanov will will info loop.current_task() to asyncio pep. I added “loop.current_task()” to latest async_timeout and to aiohttp master.

On May 10, 2017, at 1:56 PM, Nikolay Novik [email protected] wrote:

With tokio loop I am getting bunch of errors RuntimeError: Timeout context manager should be used inside a task when using loop.run_until_complete(coro) as result tests does not have a chance to start since such idiom ofter used in test fixtures. (asyncio and uvloop works as expected)

@pytest.fixture
def bucket_name(region, create_bucket, s3_client, loop):
  name = loop.run_until_complete(create_bucket(region))

E RuntimeError: Timeout context manager should be used inside a task — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PyO3/tokio/issues/34#issuecomment-300610027, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkjzlQGfoNZ_WGTl_3U7Nt1FiB0kblaks5r4iSNgaJpZM4NXLr-.

fafhrd91 avatar May 10 '17 21:05 fafhrd91

Does tokio create its own rust Tasks? Why not Futures instead?

1st1 avatar May 10 '17 21:05 1st1

@jettify aiomonitor passes tests with aiohttp master

fafhrd91 avatar May 10 '17 21:05 fafhrd91

  • https://github.com/aio-libs/aioredis - tests pass. some xfail tests pass as well, which is not good

fafhrd91 avatar May 10 '17 22:05 fafhrd91

I will merge those PRs soon, so tokio/uvloop can be tested on each PR continuously.

jettify avatar May 11 '17 07:05 jettify

@jettify I think we need separate package for various asyncio related fixtures. every library that test different event loops implements loop fixture

fafhrd91 avatar May 11 '17 16:05 fafhrd91

@fafhrd91 agreed there are few libraries, but not sure I like them (https://pypi.python.org/pypi/pytest-asyncio)

jettify avatar May 13 '17 07:05 jettify

But we have enough fixters in aiohttp and other aio libs, we just need to extract those to separate package

fafhrd91 avatar May 13 '17 15:05 fafhrd91