diff options
Diffstat (limited to 'tests/__init__.py')
-rw-r--r-- | tests/__init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index 2bcb52e7..a7b7ff22 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -6,8 +6,24 @@ import atexit import warnings +def set_dll_search_path(): + # Python 3.8 no longer searches for DLLs in PATH, so we have to add + # everything in PATH manually. Note that unlike PATH add_dll_directory + # has no defined order, so if there are two cairo DLLs in PATH we + # might get a random one. + if os.name != "nt" or not hasattr(os, "add_dll_directory"): + return + for p in os.environ.get("PATH", "").split(os.pathsep): + try: + os.add_dll_directory(p) + except OSError: + pass + + def init_test_environ(): + set_dll_search_path() + def dbus_launch_session(): if os.name == "nt" or sys.platform == "darwin": return (-1, "") |