From 0787a5a463fa942854713c2552b582edfd61f276 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Sat, 21 Nov 2026 01:06:51 +0800 Subject: [PATCH] Include PyGObject in the NixOS desktop test environment The test successfully opened Settings through GTK but pyatspi could not import gi. Include the Python binding and GLib typelibs, check imports before launch, and bound the accessibility wait. --- nix/tests/desktop-interfaces.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nix/tests/desktop-interfaces.nix b/nix/tests/desktop-interfaces.nix index 8e4a91c..abeb073 100644 --- a/nix/tests/desktop-interfaces.nix +++ b/nix/tests/desktop-interfaces.nix @@ -1,7 +1,7 @@ { pkgs, package, module }: let - testPython = pkgs.python3.withPackages (ps: [ ps.pyatspi ]); - typelibs = pkgs.lib.makeSearchPath "lib/girepository-1.0" [ pkgs.at-spi2-core pkgs.glib ]; + testPython = pkgs.python3.withPackages (ps: [ ps.pyatspi ps.pygobject3 ]); + typelibs = pkgs.lib.makeSearchPath "lib/girepository-1.0" [ pkgs.at-spi2-core pkgs.glib.out ]; chooseTauri = pkgs.writeScript "choose-tauri" '' #!${testPython}/bin/python3 import pyatspi @@ -50,6 +50,8 @@ pkgs.testers.runNixOSTest { environment = "export DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1000 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus GTK_A11Y=atspi; " return "su - alice -c " + shlex.quote(environment + command) + accessibility_env = "GI_TYPELIB_PATH=${typelibs} " + machine.succeed(as_alice(accessibility_env + "${testPython}/bin/python3 -c 'import pyatspi'")) machine.wait_until_succeeds(as_alice("xdotool getdisplaygeometry")) # Leave loopback available for the local privileged service. machine.succeed("for dev in /sys/class/net/*; do dev=$(basename \"$dev\"); [ \"$dev\" = lo ] || ip link set \"$dev\" down; done") @@ -73,7 +75,7 @@ pkgs.testers.runNixOSTest { timeout=timedelta(seconds=60), ) machine.screenshot("native-shell-settings") - machine.wait_until_succeeds(as_alice("GI_TYPELIB_PATH=${typelibs} ${chooseTauri}")) + machine.wait_until_succeeds(as_alice(accessibility_env + "${chooseTauri}"), timeout=timedelta(seconds=60)) wait_for_gui("gpgui") machine.succeed(as_alice("grep -Fx gpgui ~/.config/gpclient/gui")) machine.succeed(as_alice("kill -TERM $(cat ~/gp-launch.pid)"))