[glib: 5/12] tests/assert-msg-test: fix opening temporary file in GDB
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 5/12] tests/assert-msg-test: fix opening temporary file in GDB
- Date: Mon, 17 Oct 2022 09:53:47 +0000 (UTC)
commit 52a49eb9c27cc932ef3f9d7ca6d20698cf731a58
Author: Marc-André Lureau <marcandre lureau redhat com>
Date: Fri Oct 14 15:05:25 2022 +0400
tests/assert-msg-test: fix opening temporary file in GDB
On Win32, the file cannot be opened a second time, it must be closed
first.
Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>
glib/tests/assert-msg-test.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/glib/tests/assert-msg-test.py b/glib/tests/assert-msg-test.py
index ca0f559c4f..5e5f3fb234 100755
--- a/glib/tests/assert-msg-test.py
+++ b/glib/tests/assert-msg-test.py
@@ -146,12 +146,14 @@ class TestAssertMessage(unittest.TestCase):
self.skipTest("GDB is not installed, skipping this test!")
with tempfile.NamedTemporaryFile(
- prefix="assert-msg-test-", suffix=".gdb", mode="w"
+ prefix="assert-msg-test-", suffix=".gdb", mode="w", delete=False
) as tmp:
- tmp.write(GDB_SCRIPT)
- tmp.flush()
-
- result = self.runGdbAssertMessage("-x", tmp.name, self.__assert_msg_test)
+ try:
+ tmp.write(GDB_SCRIPT)
+ tmp.close()
+ result = self.runGdbAssertMessage("-x", tmp.name, self.__assert_msg_test)
+ finally:
+ os.unlink(tmp.name)
# Some CI environments disable ptrace (as they’re running in a
# container). If so, skip the test as there’s nothing we can do.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]