[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 25/33] iotests.py: VM: add own __enter__ method
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v7 25/33] iotests.py: VM: add own __enter__ method |
Date: |
Wed, 4 Aug 2021 12:38:05 +0300 |
In superclass __enter__ method is defined with return value type hint
'QEMUMachine'. So, mypy thinks that return value of VM.__enter__ is
QEMUMachine. Let's redefine __enter__ in VM class, to give it correct
type hint.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/iotests.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 89663dac06..025e288ddd 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -568,6 +568,10 @@ def remote_filename(path):
class VM(qtest.QEMUQtestMachine):
'''A QEMU VM'''
+ # Redefine __enter__ with proper type hint
+ def __enter__(self) -> 'VM':
+ return self
+
def __init__(self, path_suffix=''):
name = "qemu%s-%d" % (path_suffix, os.getpid())
super().__init__(qemu_prog, qemu_opts, name=name,
--
2.29.2
- Re: [PATCH v7 20/33] block/block-copy: make setting progress optional, (continued)
- [PATCH v7 18/33] block/copy-before-write: cbw_init(): use options, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 21/33] block/copy-before-write: make public block driver, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 19/33] block/copy-before-write: initialize block-copy bitmap, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 22/33] qapi: publish copy-before-write filter, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 23/33] python/qemu/machine.py: refactor _qemu_args(), Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 28/33] iotests: move 222 to tests/image-fleecing, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 24/33] python/qemu/machine: QEMUMachine: improve qmp() method, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 25/33] iotests.py: VM: add own __enter__ method,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v7 29/33] iotests.py: hmp_qemu_io: support qdev, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 26/33] iotests/222: fix pylint and mypy complains, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 27/33] iotests/222: constantly use single quotes for strings, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 30/33] iotests/image-fleecing: proper source device, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 31/33] iotests/image-fleecing: rename tgt_node, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 32/33] iotests/image-fleecing: prepare for adding new test-case, Vladimir Sementsov-Ogievskiy, 2021/08/04
- [PATCH v7 33/33] iotests/image-fleecing: add test-case for copy-before-write filter, Vladimir Sementsov-Ogievskiy, 2021/08/04