Total Complexity | 4 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 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 |