Skip to content

Commit 45c3b35

Browse files
committed
conftest: fix or hide some linter issues
Signed-off-by: Emmanuel Varagnat <[email protected]>
1 parent e3b5c78 commit 45c3b35

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

conftest.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,20 @@
44

55
import itertools
66
import logging
7-
import os
87
import tempfile
98

109
import git
1110
from packaging import version
1211

1312
import lib.config as global_config
1413
from lib import pxe
15-
from lib import commands
1614
from lib.common import (
17-
callable_marker,
1815
DiskDevName,
1916
HostAddress,
17+
callable_marker,
2018
is_uuid,
2119
prefix_object_name,
22-
setup_formatted_and_mounted_disk,
2320
shortened_nodeid,
24-
teardown_formatted_and_mounted_disk,
2521
vm_image,
2622
wait_for,
2723
)
@@ -35,7 +31,9 @@
3531
# Import package-scoped fixtures. Although we need to define them in a separate file so that we can
3632
# then import them in individual packages to fix the buggy package scope handling by pytest, we also
3733
# need to import them in the global conftest.py so that they are recognized as fixtures.
38-
from pkgfixtures import formatted_and_mounted_ext4_disk, sr_disk_wiped
34+
# Linters might be confused by that and see these imports as unused. The `noqa` suppresses the
35+
# false-positive warnings.
36+
from pkgfixtures import formatted_and_mounted_ext4_disk, sr_disk_wiped # noqa
3937

4038
from typing import Dict, Generator, Iterable
4139

@@ -321,7 +319,7 @@ def xfail_on_xcpng_8_3(host, request):
321319
@pytest.fixture(scope='session')
322320
def host_no_ipv6(host):
323321
if is_ipv6(host.hostname_or_ip):
324-
pytest.skip(f"This test requires an IPv4 XCP-ng")
322+
pytest.skip("This test requires an IPv4 XCP-ng")
325323

326324
@pytest.fixture(scope="session")
327325
def shared_sr(host):
@@ -442,9 +440,7 @@ def vm_ref(request):
442440
logging.info(">> No VM specified on CLI, and no default found in test definition. Using global default.")
443441
ref = 'mini-linux-x86_64-bios'
444442

445-
if is_uuid(ref):
446-
return ref
447-
elif ref.startswith('http'):
443+
if is_uuid(ref) or ref.startswith('http'):
448444
return ref
449445
else:
450446
return vm_image(ref)

0 commit comments

Comments
 (0)