Passed
Push — master ( 15e965...99a8a8 )
by Vinicius
12:21 queued 09:08
created

tests.conftest.ev_loop()   A

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
"""Unit test fixtures."""
2
# pylint: disable=redefined-outer-name
3
4
import pytest
5
6
from kytos.core import Controller
7
from kytos.lib.helpers import get_controller_mock
8
9
10
@pytest.fixture(autouse=True)
11
def ev_loop(monkeypatch, event_loop) -> None:
12
    """asyncio event loop autouse fixture."""
13
    monkeypatch.setattr("asyncio.get_running_loop", lambda: event_loop)
14
    yield event_loop
15
16
17
@pytest.fixture
18
def controller() -> Controller:
19
    """Controller fixture."""
20
    yield get_controller_mock()
21
22
23
@pytest.fixture
24
def api_client(controller):
25
    """Flask app test_client instance."""
26
    yield controller.api_server.app.test_client()
27