File: tests-Exercise-GioUnix.FDMessage-methods.patch

package info (click to toggle)
pygobject 3.50.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,592 kB
  • sloc: python: 22,999; ansic: 22,948; sh: 468; makefile: 74; xml: 35
file content (36 lines) | stat: -rw-r--r-- 1,440 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: Simon McVittie <smcv@debian.org>
Date: Wed, 8 Oct 2025 11:57:13 +0100
Subject: tests: Exercise GioUnix.FDMessage methods

Helps: https://gitlab.gnome.org/GNOME/pygobject/-/issues/719
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: https://gitlab.gnome.org/GNOME/pygobject/-/merge_requests/456
---
 tests/test_gio.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/test_gio.py b/tests/test_gio.py
index ee0d23e..a8233a3 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -197,6 +197,20 @@ Exec={GLib.find_program_in_path("true")} action
             self.assertIsInstance(app_info, Gio.DesktopAppInfo)
             self.assertIsInstance(app_info, Gio.AppInfo)
 
+    @unittest.skipIf(
+        GioUnix is None or "FDMessage" not in dir(GioUnix), "Not supported"
+    )
+    def test_fd_message(self):
+        message = GioUnix.FDMessage.new()
+        self.assertIsNotNone(message)
+
+        with open("/dev/null", "r+b") as devnull:
+            self.assertTrue(message.append_fd(devnull.fileno()))
+            self.assertIsNotNone(message.get_fd_list())
+            fds = message.steal_fds()
+            self.assertEqual(len(fds), 1)
+            os.close(fds[0])
+
     @unittest.skipIf(GioUnix is None, "Not supported")
     def test_gio_unix_desktop_app_info_provides_platform_independent_functions(self):
         app_info = GioUnix.DesktopAppInfo.new_from_keyfile(self.key_file)