[pygobject] tests: extend the meson cext import hack to _gi_cairo. Fixes #242



commit ea1587c6fc57f1765258a634e3968935aeebd88c
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Wed Aug 15 15:04:39 2018 +0200

    tests: extend the meson cext import hack to _gi_cairo. Fixes #242
    
    It imports the modules directly and puts them in sys.modules under the full
    name. gi._gi_cairo was missing which made it import the system version
    (because the gi package is registered as a namespace package).
    
    Handle gi._gi_cairo there as well.

 tests/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/tests/__init__.py b/tests/__init__.py
index eaa541d9..8b5f1111 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -12,14 +12,14 @@ import imp
 
 class GIImport:
     def find_module(self, fullname, path=None):
-        if fullname == 'gi._gi':
+        if fullname in ('gi._gi', 'gi._gi_cairo'):
             return self
         return None
 
     def load_module(self, name):
         if name in sys.modules:
             return sys.modules[name]
-        module_info = imp.find_module('_gi')
+        module_info = imp.find_module(name.split('.')[-1])
         module = imp.load_module(name, *module_info)
         sys.modules[name] = module
         return module


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]