[pygobject] tests: Remove metapath hack to import when uninstalled
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] tests: Remove metapath hack to import when uninstalled
- Date: Sat, 7 Nov 2020 08:09:44 +0000 (UTC)
commit 030aa5f5db380efa73802cb92cb92d156c3dc860
Author: Christoph Reiter <reiter christoph gmail com>
Date: Fri Nov 6 15:48:56 2020 +0100
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():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]