mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
Python/iotests: Add type hint for nbd module
The test bails gracefully if this module isn't installed, but linters need a little help understanding that. It's enough to just declare the type in this case. (Fixes pylint complaining about use of an uninitialized variable because it isn't wise enough to understand the notrun call is noreturn.) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-id: 20231006195243.3131140-2-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
from types import ModuleType
|
||||||
|
|
||||||
import iotests
|
import iotests
|
||||||
from iotests import qemu_img_create, qemu_io
|
from iotests import qemu_img_create, qemu_io
|
||||||
|
|
||||||
@ -28,7 +30,7 @@ disk = os.path.join(iotests.test_dir, 'disk')
|
|||||||
size = '4M'
|
size = '4M'
|
||||||
nbd_sock = os.path.join(iotests.sock_dir, 'nbd_sock')
|
nbd_sock = os.path.join(iotests.sock_dir, 'nbd_sock')
|
||||||
nbd_uri = 'nbd+unix:///{}?socket=' + nbd_sock
|
nbd_uri = 'nbd+unix:///{}?socket=' + nbd_sock
|
||||||
|
nbd: ModuleType
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def open_nbd(export_name):
|
def open_nbd(export_name):
|
||||||
|
Reference in New Issue
Block a user