Skip to content

Commit

Permalink
iotests: Fix incomplete type declarations
Browse files Browse the repository at this point in the history
We need to fix only a few places so that iotests.py can pass
mypy --disallow-incomplete-defs, which seems to be a desirable option to
have enabled in the long run.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200511163529.349329-2-kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
kevmw committed May 18, 2020
1 parent e140f4b commit cd8f5b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/qemu-iotests/iotests.py
Expand Up @@ -1040,7 +1040,7 @@ def _verify_cache_mode(supported_cache_modes: Sequence[str] = ()) -> None:
if supported_cache_modes and (cachemode not in supported_cache_modes):
notrun('not suitable for this cache mode: %s' % cachemode)

def _verify_aio_mode(supported_aio_modes: Sequence[str] = ()):
def _verify_aio_mode(supported_aio_modes: Sequence[str] = ()) -> None:
if supported_aio_modes and (aiomode not in supported_aio_modes):
notrun('not suitable for this aio mode: %s' % aiomode)

Expand Down Expand Up @@ -1087,7 +1087,8 @@ def skip_if_unsupported(required_formats=(), read_only=False):
'''Skip Test Decorator
Runs the test if all the required formats are whitelisted'''
def skip_test_decorator(func):
def func_wrapper(test_case: QMPTestCase, *args, **kwargs):
def func_wrapper(test_case: QMPTestCase, *args: List[Any],
**kwargs: Dict[str, Any]) -> None:
if callable(required_formats):
fmts = required_formats(test_case)
else:
Expand All @@ -1097,9 +1098,8 @@ def func_wrapper(test_case: QMPTestCase, *args, **kwargs):
if usf_list:
msg = f'{test_case}: formats {usf_list} are not whitelisted'
test_case.case_skip(msg)
return None
else:
return func(test_case, *args, **kwargs)
func(test_case, *args, **kwargs)
return func_wrapper
return skip_test_decorator

Expand Down

0 comments on commit cd8f5b7

Please sign in to comment.