File: test_tests.py

package info (click to toggle)
aiocoap 0.4.17-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,040 kB
  • sloc: python: 17,241; makefile: 23; sh: 9
file content (27 lines) | stat: -rw-r--r-- 900 bytes parent folder | download
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()))