[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 25/33] iotests.py: VM: add own __enter__ method
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v2 25/33] iotests.py: VM: add own __enter__ method |
Date: |
Thu, 20 May 2021 17:21:57 +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>
---
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 777fa2ec0e..c7ec16c082 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 v2 12/33] block/copy-before-write: drop extra bdrv_unref on failure path, (continued)
- [PATCH v2 13/33] block/copy-before-write: use file child instead of backing, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 23/33] python/qemu/machine.py: refactor _qemu_args(), Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 28/33] iotests: move 222 to tests/image-fleecing, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 14/33] block/copy-before-write: bdrv_cbw_append(): replace child at last, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 15/33] block/copy-before-write: introduce cbw_init(), Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 16/33] block/copy-before-write: cbw_init(): rename variables, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 25/33] iotests.py: VM: add own __enter__ method,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v2 18/33] block/copy-before-write: cbw_init(): use options, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 27/33] iotests/222: constantly use single quotes for strings, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 17/33] block/copy-before-write: cbw_init(): use file child after attaching, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 26/33] iotests/222: fix pylint and mypy complains, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 22/33] qapi: publish copy-before-write filter, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 19/33] block/copy-before-write: initialize block-copy bitmap, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 20/33] block/block-copy: make setting progress optional, Vladimir Sementsov-Ogievskiy, 2021/05/20
- [PATCH v2 24/33] python/qemu/machine: QEMUMachine: improve qmp() method, Vladimir Sementsov-Ogievskiy, 2021/05/20