1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# SPDX-FileCopyrightText: Christian Amsüss and the aiocoap contributors
#
# SPDX-License-Identifier: MIT
"""Test for the test infrastructure itself
… which is sadly complex enough to need it"""
import asyncio
import os
from .fixtures import IsolatedAsyncioTestCase
class TestRightRunner(IsolatedAsyncioTestCase):
async def test_right_runner(self):
"""Are we really running on the selected event loop?
(loop_factory gets assigned, but there's too much that can go wrong
with this not to test it)"""
if os.environ.get("AIOCOAP_TESTS_LOOP", None) == "uvloop":
assert "uvloop" in str(type(asyncio.get_running_loop()))
elif os.environ.get("AIOCOAP_TESTS_LOOP", None) == "glib":
assert "GLib" in str(type(asyncio.get_running_loop()))
else:
assert "<class 'asyncio." in str(type(asyncio.get_running_loop()))
|