]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
iotests: Change imports for Python 3.13
authorJohn Snow <jsnow@redhat.com>
Wed, 26 Jun 2024 23:22:29 +0000 (19:22 -0400)
committerJohn Snow <jsnow@redhat.com>
Fri, 12 Jul 2024 20:36:20 +0000 (16:36 -0400)
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>
tests/qemu-iotests/testenv.py
tests/qemu-iotests/testrunner.py

index 588f30a4f14ec75979ba6e239265c3cb6244180b..96d69e56963f30786c7632eb57d437b1672f6e05 100644 (file)
@@ -25,7 +25,12 @@ import collections
 import random
 import subprocess
 import glob
-from typing import List, Dict, Any, Optional, ContextManager
+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'
 
index 7b322272e9208e17b4d96d98bff4f2bddbe67997..2e236c8fa3906928c488c453c139ec3125b69ec8 100644 (file)
@@ -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: