[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 27/35] iotests.py: VM: add own __enter__ method
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v3 27/35] iotests.py: VM: add own __enter__ method |
Date: |
Tue, 1 Jun 2021 19:50:18 +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 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
- [PATCH v3 20/35] block/copy-before-write: cbw_init(): use options, (continued)
- [PATCH v3 20/35] block/copy-before-write: cbw_init(): use options, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 22/35] block/block-copy: make setting progress optional, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 28/35] iotests/222: fix pylint and mypy complains, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 23/35] block/copy-before-write: make public block driver, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 24/35] qapi: publish copy-before-write filter, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 29/35] iotests/222: constantly use single quotes for strings, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 25/35] python/qemu/machine.py: refactor _qemu_args(), Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 33/35] iotests/image-fleecing: rename tgt_node, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 26/35] python/qemu/machine: QEMUMachine: improve qmp() method, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 30/35] iotests: move 222 to tests/image-fleecing, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 27/35] iotests.py: VM: add own __enter__ method,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v3 31/35] iotests.py: hmp_qemu_io: support qdev, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 34/35] iotests/image-fleecing: prepare for adding new test-case, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 35/35] iotests/image-fleecing: add test-case for copy-before-write filter, Vladimir Sementsov-Ogievskiy, 2021/06/01
- [PATCH v3 32/35] iotests/image-fleecing: proper source device, Vladimir Sementsov-Ogievskiy, 2021/06/01
- DROP Re: [PATCH v3 00/35] block: publish backup-top filter, Vladimir Sementsov-Ogievskiy, 2021/06/02