From 6bd634e7ad962866f8e10aa8b2e4b95a74fe43ee Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 3 Mar 2025 12:48:37 +0000 Subject: [PATCH] =?UTF-8?q?tests:=20Mock=20logind=E2=80=99s=20Inhibit=20me?= =?UTF-8?q?thod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed to allow gnome-shell to start up during its unit tests, as it now calls `Inhibit` to make saving screen time information race-free. See https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3643#note_2367420. Signed-off-by: Philip Withnall Helps: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8185 Part-of: --- src/tests/dbusmock-templates/logind.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tests/dbusmock-templates/logind.py b/src/tests/dbusmock-templates/logind.py index ca8b5e5ff..7c6ea1e06 100644 --- a/src/tests/dbusmock-templates/logind.py +++ b/src/tests/dbusmock-templates/logind.py @@ -158,6 +158,11 @@ def GetSessionByPID(self, pid): session_path = f'{MAIN_OBJ}/session/{self.preferred_session_id}' return session_path +@dbus.service.method(MANAGER_IFACE, in_signature='ssss', out_signature='h') +def Inhibit(self, what, who, why, mode): + # Return an arbitrary FD + return os.open('/dev/null', os.O_RDONLY) + def create_session(self, host_bus): session_id = None seat_id = None