From 030aa5f5db380efa73802cb92cb92d156c3dc860 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 6 Nov 2020 15:48:56 +0100 Subject: tests: Remove metapath hack to import when uninstalled This was required for Python 2 where Python didn't import our built modules in the build dir because there is no __init__.py. In Python 3 this just works. Tested with setup.py/pytest/meson --- tests/__init__.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 44068d2c..b96f8a8d 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -5,29 +5,6 @@ import signal import subprocess import atexit import warnings -import imp - - -class GIImport: - def find_module(self, fullname, path=None): - 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] - fp, pathname, description = imp.find_module(name.split('.')[-1]) - try: - module = imp.load_module(name, fp, pathname, description) - finally: - if fp: - fp.close() - sys.modules[name] = module - return module - - -sys.meta_path.insert(0, GIImport()) def init_test_environ(): -- cgit v1.2.1