From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Hanna Reitz" <hreitz@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>, "John Snow" <jsnow@redhat.com>,
qemu-block@nongnu.org, "Daniel Berrangé" <berrange@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>
Subject: [PATCH 15/19] iotests: drop compat for old version context manager
Date: Mon, 1 Sep 2025 16:26:57 -0400 [thread overview]
Message-ID: <20250901202702.2971212-16-jsnow@redhat.com> (raw)
In-Reply-To: <20250901202702.2971212-1-jsnow@redhat.com>
From: Daniel P. Berrangé <berrange@redhat.com>
Our minimum python is now 3.9, so back compat with prior
python versions is no longer required.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
tests/qemu-iotests/testenv.py | 7 ++-----
tests/qemu-iotests/testrunner.py | 9 ++-------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index 6326e46b7b1..29caaa8a349 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -22,15 +22,12 @@
from pathlib import Path
import shutil
import collections
+import contextlib
import random
import subprocess
import glob
from typing import List, Dict, Any, Optional
-if sys.version_info >= (3, 9):
- from contextlib import AbstractContextManager as ContextManager
-else:
- from typing import ContextManager
DEF_GDB_OPTIONS = 'localhost:12345'
@@ -58,7 +55,7 @@ def get_default_machine(qemu_prog: str) -> str:
return default_machine
-class TestEnv(ContextManager['TestEnv']):
+class TestEnv(contextlib.AbstractContextManager['TestEnv']):
"""
Manage system environment for running tests
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index 2e236c8fa39..14cc8492f9f 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -30,11 +30,6 @@
from typing import List, Optional, Any, Sequence, Dict
from testenv import TestEnv
-if sys.version_info >= (3, 9):
- from contextlib import AbstractContextManager as ContextManager
-else:
- from typing import ContextManager
-
def silent_unlink(path: Path) -> None:
try:
@@ -57,7 +52,7 @@ def file_diff(file1: str, file2: str) -> List[str]:
return res
-class LastElapsedTime(ContextManager['LastElapsedTime']):
+class LastElapsedTime(contextlib.AbstractContextManager['LastElapsedTime']):
""" Cache for elapsed time for tests, to show it during new test run
It is safe to use get() at any time. To use update(), you must either
@@ -112,7 +107,7 @@ def __init__(self, status: str, description: str = '',
self.interrupted = interrupted
-class TestRunner(ContextManager['TestRunner']):
+class TestRunner(contextlib.AbstractContextManager['TestRunner']):
shared_self = None
@staticmethod
--
2.50.1
next prev parent reply other threads:[~2025-09-01 20:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-01 20:26 [PATCH 00/19] python: 3.14 compatibility and python-qemu-qmp synchronization John Snow
2025-09-01 20:26 ` [PATCH 01/19] python: backport 'Change error classes to have better repr methods' John Snow
2025-09-01 20:26 ` [PATCH 02/19] python: backport 'EventListener: add __repr__ method' John Snow
2025-09-01 20:26 ` [PATCH 03/19] python: backport 'kick event queue on legacy event_pull()' John Snow
2025-09-01 20:26 ` [PATCH 04/19] python: backport 'protocol: adjust logging name when changing client name' John Snow
2025-09-01 20:26 ` [PATCH 05/19] python: backport 'drop Python3.6 workarounds' John Snow
2025-09-01 20:26 ` [PATCH 06/19] python: backport 'qmp-shell: add common_parser()' John Snow
2025-09-01 20:26 ` [PATCH 07/19] python: backport 'feat: allow setting read buffer limit' John Snow
2025-09-01 20:26 ` [PATCH 08/19] python: backport 'make require() preserve async-ness' John Snow
2025-09-01 20:26 ` [PATCH 09/19] python: backport 'qmp-shell-wrap: handle missing binary gracefully' John Snow
2025-09-01 20:26 ` [PATCH 10/19] python: backport 'qmp-tui: Do not crash if optional dependencies are not met' John Snow
2025-09-01 20:26 ` [PATCH 11/19] python: backport 'Remove deprecated get_event_loop calls' John Snow
2025-09-01 20:26 ` [PATCH 12/19] python: backport '*really* remove get_event_loop' John Snow
2025-09-01 20:26 ` [PATCH 13/19] python: backport 'python: avoid creating additional event loops per thread' John Snow
2025-09-01 20:26 ` [PATCH 14/19] python: synchronize qemu.qmp documentation John Snow
2025-09-01 20:26 ` John Snow [this message]
2025-09-01 20:26 ` [PATCH 16/19] python: ensure QEMUQtestProtocol closes its socket John Snow
2025-09-01 20:26 ` [PATCH 17/19] iotests/147: ensure temporary sockets are closed before exiting John Snow
2025-09-01 20:27 ` [PATCH 18/19] iotests/151: ensure subprocesses are cleaned up John Snow
2025-09-01 20:27 ` [PATCH 19/19] iotests/check: always enable all python warnings John Snow
2025-09-02 16:54 ` [PATCH 00/19] python: 3.14 compatibility and python-qemu-qmp synchronization Daniel P. Berrangé
2025-09-02 16:58 ` John Snow
2025-09-02 19:34 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250901202702.2971212-16-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).