tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d496e6b1f70a1071107eba0881ec0b08b6cc609f
parent 2eb99af37475ff8ff2b4757ff0fdebc5a821a9da
Author: Eitan Isaacson <eitan@monotonous.org>
Date:   Thu, 16 Oct 2025 22:41:17 +0000

Bug 1994507 - Append paths for both pyatspi and gi for atk tests. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D268750

Diffstat:
Maccessible/tests/browser/atk/a11y_setup.py | 29++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/accessible/tests/browser/atk/a11y_setup.py b/accessible/tests/browser/atk/a11y_setup.py @@ -2,8 +2,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -"""Python environment for ATK a11y browser tests. -""" +"""Python environment for ATK a11y browser tests.""" import os import subprocess @@ -13,19 +12,23 @@ import psutil # pyatspi can't be installed using pip. Rely on the system installation. # Get the path to the system installation of pyatspi. -pyatspiFile = subprocess.check_output( - ( - os.path.join(sys.base_prefix, "bin", "python3"), - "-c", - "import pyatspi; print(pyatspi.__file__)", - ), - encoding="utf-8", -).rstrip() -sys.path.append(os.path.dirname(os.path.dirname(pyatspiFile))) +# Some systems have pyatspi and gi in different locations, so get both. +extraPaths = eval( + subprocess.check_output( + ( + os.path.join(sys.base_prefix, "bin", "python3"), + "-c", + "import pyatspi, gi; print(repr([pyatspi.__file__, gi.__file__]))", + ), + encoding="utf-8", + ).rstrip() +) + +sys.path += [os.path.dirname(os.path.dirname(p)) for p in extraPaths] import pyatspi -sys.path.pop() -del pyatspiFile +del sys.path[-len(extraPaths) :] +del extraPaths def setup():