qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/functional/m68k: Avoid ResourceWarning in the nextcube test
@ 2025-08-29 14:20 Thomas Huth
  2025-08-29 14:22 ` Daniel P. Berrangé
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2025-08-29 14:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P . Berrangé, Thomas Huth

From: Thomas Huth <thuth@redhat.com>

Since commit c3fd296cf7b1 ("functional: always enable all python
warnings") we enabled more warnings for the functional tests. This
triggers now a warning in the nextcube test:

 tests/functional/m68k/test_nextcube.py:47: ResourceWarning:
  unclosed file <_io.BufferedReader name='tests/functional/m68k/test_nextcube.NextCubeMachine.test_bootrom_framebuffer_size/scratch/dump.ppm'>
   width, height = Image.open(screenshot_path).size

Use a proper "with" context to avoid it.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/m68k/test_nextcube.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/functional/m68k/test_nextcube.py b/tests/functional/m68k/test_nextcube.py
index 13c72bd136a..c1610e58456 100755
--- a/tests/functional/m68k/test_nextcube.py
+++ b/tests/functional/m68k/test_nextcube.py
@@ -44,7 +44,8 @@ def test_bootrom_framebuffer_size(self):
         self.check_bootrom_framebuffer(screenshot_path)
 
         from PIL import Image
-        width, height = Image.open(screenshot_path).size
+        with Image.open(screenshot_path) as image:
+                width, height = image.size
         self.assertEqual(width, 1120)
         self.assertEqual(height, 832)
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests/functional/m68k: Avoid ResourceWarning in the nextcube test
  2025-08-29 14:20 [PATCH] tests/functional/m68k: Avoid ResourceWarning in the nextcube test Thomas Huth
@ 2025-08-29 14:22 ` Daniel P. Berrangé
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel P. Berrangé @ 2025-08-29 14:22 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel

On Fri, Aug 29, 2025 at 04:20:00PM +0200, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> Since commit c3fd296cf7b1 ("functional: always enable all python
> warnings") we enabled more warnings for the functional tests. This
> triggers now a warning in the nextcube test:
> 
>  tests/functional/m68k/test_nextcube.py:47: ResourceWarning:
>   unclosed file <_io.BufferedReader name='tests/functional/m68k/test_nextcube.NextCubeMachine.test_bootrom_framebuffer_size/scratch/dump.ppm'>
>    width, height = Image.open(screenshot_path).size
> 
> Use a proper "with" context to avoid it.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/functional/m68k/test_nextcube.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-30 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 14:20 [PATCH] tests/functional/m68k: Avoid ResourceWarning in the nextcube test Thomas Huth
2025-08-29 14:22 ` Daniel P. Berrangé

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).