Passed
Pull Request — master (#4)
by Guibert
50s
created

tests.conftest.run()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 2
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