[meld/flatpak-ci] test: Duplicate conf.py.in hack for unit tests



commit 680030fa1f6598f491d7569fae70689dcf062ac4
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Nov 30 07:21:21 2019 +1000

    test: Duplicate conf.py.in hack for unit tests

 test/conftest.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/test/conftest.py b/test/conftest.py
index 3c0977d8..f8959385 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -1,4 +1,7 @@
 
+import importlib.machinery
+import importlib.util
+import sys
 from unittest import mock
 
 import pytest
@@ -23,3 +26,18 @@ def template_resources():
             'gi._gtktemplate.validate_resource_path',
             mock.Mock(return_value=True)):
         yield
+
+
+def import_meld_conf():
+    loader = importlib.machinery.SourceFileLoader(
+        'meld.conf', './meld/conf.py.in')
+    spec = importlib.util.spec_from_loader(loader.name, loader)
+    mod = importlib.util.module_from_spec(spec)
+    loader.exec_module(mod)
+
+    import meld
+    meld.conf = mod
+    sys.modules['meld.conf'] = mod
+
+
+import_meld_conf()


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