From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
"Thomas Huth" <thuth@redhat.com>
Subject: [PATCH] tests/functional/m68k: Avoid ResourceWarning in the nextcube test
Date: Fri, 29 Aug 2025 16:20:00 +0200 [thread overview]
Message-ID: <20250829142000.62320-1-thuth@redhat.com> (raw)
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
next reply other threads:[~2025-08-30 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 14:20 Thomas Huth [this message]
2025-08-29 14:22 ` [PATCH] tests/functional/m68k: Avoid ResourceWarning in the nextcube test 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=20250829142000.62320-1-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=berrange@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.