summary refs log tree commit diff stats
path: root/tests/qemu-iotests/testrunner.py
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2024-06-26 19:22:29 -0400
committerJohn Snow <jsnow@redhat.com>2024-07-12 16:36:20 -0400
commite38900450fa900828cd7d5bc84c3a6a8af693696 (patch)
treee123921581d624b0851dc0f6f709abb622433f49 /tests/qemu-iotests/testrunner.py
parentc5be244534f918adf5aea0ced9cf13344be3e62b (diff)
downloadfocaccia-qemu-e38900450fa900828cd7d5bc84c3a6a8af693696.tar.gz
focaccia-qemu-e38900450fa900828cd7d5bc84c3a6a8af693696.zip
iotests: Change imports for Python 3.13
Python 3.13 isn't out yet, but it's in beta and Fedora is ramping up to
make it the default system interpreter for Fedora 41.

They moved our cheese for where ContextManager lives; add a conditional
to locate it while we support both pre-3.9 and 3.13+.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20240626232230.408004-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/testrunner.py')
-rw-r--r--tests/qemu-iotests/testrunner.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index 7b322272e9..2e236c8fa3 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -27,11 +27,14 @@ import json
 import shutil
 import sys
 from multiprocessing import Pool
-from typing import List, Optional, Any, Sequence, Dict, \
-        ContextManager
-
+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: