Skip to content

Commit 0f78af6

Browse files
test_ip, test_biosdevname_ns: Add typing stub, cleanup import & print
Add typing stub for pytest_forked, cleanup import; print() -> assert Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
1 parent cbe5903 commit 0f78af6

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

stubs/pytest_forked.pyi

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def serialize_report(rep): ...
2+
def pytest_addoption(parser) -> None: ...
3+
def pytest_load_initial_conftests(early_config, parser, args) -> None: ...
4+
def pytest_runtest_protocol(item): ...
5+
def forked_run_report(item): ...
6+
def report_process_crash(item, result): ...

tests/test_biosdevname_ns.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import unittest
33
from os import system
44

5-
import pytest # type: ignore # for pyre in tox only
6-
import pytest_forked # type: ignore # pylint: disable=unused-import # This needs pytest-forked
5+
import pytest
6+
import pytest_forked # pylint: disable=unused-import # Ensure pytest-forked is installed
77

88
import xcp.net.biosdevname
99

@@ -12,11 +12,11 @@
1212

1313
def check_devices(self, devices):
1414
for item in devices.items():
15-
print(item[0])
16-
print(item[1]["BIOS device"])
17-
print(item[1]["Assigned MAC"])
18-
print(item[1]["Bus Info"])
19-
print(item[1]["Driver"])
15+
assert item[0]
16+
assert item[1]["BIOS device"]
17+
assert item[1]["Assigned MAC"]
18+
assert item[1]["Bus Info"]
19+
assert item[1]["Driver"]
2020

2121

2222
class TestDeviceNames(unittest.TestCase):

tests/test_ip.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import unittest
55
from subprocess import PIPE
66

7-
import pytest # type: ignore # for pyre in tox only
8-
import pytest_forked # type: ignore # pylint: disable=unused-import # This needs pytest-forked
7+
import pytest
8+
import pytest_forked # pylint: disable=unused-import # Ensure pytest-forked is installed
99
from mock import Mock, patch
1010

1111
import xcp.net.ip

0 commit comments

Comments
 (0)