Passed
Branch master (19896e)
by Guibert
53s
created

tests.conftest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
"""Unit tests configuration file."""
2
3
import logging
4
5
import pytest
6
from curio import Kernel
7
from curio.debug import logcrash, longblock
8
from curio.monitor import Monitor
9
10
11
@pytest.fixture(scope='session')
12
def kernel(request):
13
    k = Kernel(debug=[longblock, logcrash])
14
    m = Monitor(k)
15
    request.addfinalizer(lambda: k.run(shutdown=True))
16
    request.addfinalizer(m.close)
17
    return k
18
19
20
def pytest_configure(config):
21
    """Disable verbose output when running tests."""
22
    _logger = logging.getLogger()
23
    _logger.setLevel(logging.DEBUG)
24
25
    terminal = config.pluginmanager.getplugin('terminal')
26
    terminal.TerminalReporter.showfspath = False
27
28
29
def run(corofunc, *args):
30
31
    kernel().run(corofunc, *args)
32