Test Failed
Pull Request — master (#88)
by Vinicius
02:33
created

build.tests.conftest.ev_loop()   A

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 2
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
"""Conftest."""
2 1
from unittest.mock import MagicMock
3
4 1
import pytest
5 1
from kytos.lib.helpers import get_interface_mock, get_switch_mock
6
7 1
from napps.kytos.of_lldp.controllers import LivenessController
8 1
from napps.kytos.of_lldp.managers.liveness import ILSM, LSM, LivenessManager
9
10
11 1
@pytest.fixture(autouse=True)
12 1
def ev_loop(monkeypatch, event_loop) -> None:
13
    """asyncio event loop autouse fixture."""
14 1
    monkeypatch.setattr("asyncio.get_running_loop", lambda: event_loop)
15
    yield event_loop
16
17 1
18 1
@pytest.fixture
19
def ilsm() -> None:
20 1
    """ISLM fixture."""
21
    return ILSM()
22
23 1
24 1
@pytest.fixture
25
def lsm() -> None:
26 1
    """LSM fixture."""
27
    return LSM(ILSM(), ILSM())
28
29 1
30 1
@pytest.fixture
31
def switch_one():
32 1
    """Switch one fixture."""
33
    return get_switch_mock("00:00:00:00:00:00:00:01", 0x04)
34
35 1
36 1
@pytest.fixture
37
def switch_two():
38 1
    """Switch one fixture."""
39
    return get_switch_mock("00:00:00:00:00:00:00:02", 0x04)
40
41 1
42 1
@pytest.fixture
43
def intf_one(switch_one):
44 1
    """Interface one fixture."""
45
    return get_interface_mock("s1-eth1", 1, switch_one)
46
47 1
48 1
@pytest.fixture
49
def intf_two(switch_two):
50 1
    """Interface two fixture."""
51
    return get_interface_mock("s2-eth1", 1, switch_two)
52
53 1
54 1
@pytest.fixture
55
def intf_three(switch_two):
56 1
    """Interface three fixture."""
57
    return get_interface_mock("s2-eth2", 2, switch_two)
58
59 1
60 1
@pytest.fixture
61
def liveness_manager():
62 1
    """LivenessManager fixture."""
63
    return LivenessManager(MagicMock())
64
65
66
@pytest.fixture
67
def liveness_controller() -> None:
68
    """LivenessController."""
69
    return LivenessController(MagicMock())
70