[PATCH] iotests/iothreads-stream: Use the right TimeoutError

Kevin Wolf posted 1 patch 2 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240125152150.42389-1-kwolf@redhat.com
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
tests/qemu-iotests/tests/iothreads-stream | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] iotests/iothreads-stream: Use the right TimeoutError
Posted by Kevin Wolf 2 years ago
Since Python 3.11 asyncio.TimeoutError is an alias for TimeoutError, but
in older versions it's not. We really have to catch asyncio.TimeoutError
here, otherwise a slow test run will fail (as has happened multiple
times on CI recently).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/tests/iothreads-stream | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/tests/iothreads-stream b/tests/qemu-iotests/tests/iothreads-stream
index 503f221f16..231195b5e8 100755
--- a/tests/qemu-iotests/tests/iothreads-stream
+++ b/tests/qemu-iotests/tests/iothreads-stream
@@ -18,6 +18,7 @@
 #
 # Creator/Owner: Kevin Wolf <kwolf@redhat.com>
 
+import asyncio
 import iotests
 
 iotests.script_initialize(supported_fmts=['qcow2'],
@@ -69,6 +70,6 @@ with iotests.FilePath('disk1.img') as base1_path, \
                 # The test is done once both jobs are gone
                 if finished == 2:
                     break
-        except TimeoutError:
+        except asyncio.TimeoutError:
             pass
         vm.cmd('query-jobs')
-- 
2.43.0
Re: [PATCH] iotests/iothreads-stream: Use the right TimeoutError
Posted by Stefan Hajnoczi 2 years ago
On Thu, Jan 25, 2024 at 04:21:50PM +0100, Kevin Wolf wrote:
> Since Python 3.11 asyncio.TimeoutError is an alias for TimeoutError, but
> in older versions it's not. We really have to catch asyncio.TimeoutError
> here, otherwise a slow test run will fail (as has happened multiple
> times on CI recently).
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/tests/iothreads-stream | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>