File: not_asyncio_test.py

package info (click to toggle)
python-eventlet 0.40.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,200 kB
  • sloc: python: 25,101; sh: 78; makefile: 31
file content (23 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Tests for hubs that are not asyncio-based."""

import pytest

from eventlet.hubs import get_hub
from eventlet.hubs.asyncio import Hub as AsyncioHub
from eventlet.asyncio import spawn_for_awaitable

if isinstance(get_hub(), AsyncioHub):
    pytest.skip("Only works on non-asyncio hub", allow_module_level=True)


def test_spawn_from_coroutine_errors():
    """
    If ``spawn_for_awaitable()`` is called in a non-asyncio hub it will raise a
    ``RuntimeError``.
    """

    async def go():
        return 13

    with pytest.raises(RuntimeError):
        spawn_for_awaitable(go())