[pygobject/pygobject-2-28] Fix GSchema tests for separate build tree



commit cd38572b9781502d3228e74c017cb7cc39a07b3d
Author: Martin Pitt <martin pitt ubuntu com>
Date:   Tue Mar 22 15:04:01 2011 +0100

    Fix GSchema tests for separate build tree
    
    When using a separate build tree, the compiled GSettings schema will be in the
    build tree, but as the test scripts are only in the source tree they won't find
    the compiled schema. Pass the build dir as environment variable and prefer it
    over test_overrides.py's directory.

 tests/Makefile.am       |    3 ++-
 tests/test_overrides.py |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9cdb57f..bad15f0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -116,7 +116,8 @@ RUN_TESTS_ENV_VARS= \
 	PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \
 	LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \
 	GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \
-	XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share
+	XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \
+	TESTS_BUILDDIR=$(builddir)
 RUN_TESTS_LAUNCH=$(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) $(srcdir)/runtests.py
 
 # run tests in separately to avoid loading static and introspection bindings in the same process
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index ea28d18..3421c3a 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1383,7 +1383,9 @@ class TestGtk(unittest.TestCase):
 class TestGio(unittest.TestCase):
     def setUp(self):
         os.environ['GSETTINGS_BACKEND'] = 'memory'
-        os.environ['GSETTINGS_SCHEMA_DIR'] = os.path.dirname(__file__)
+        # support a separate build tree, so look in build dir first
+        os.environ['GSETTINGS_SCHEMA_DIR'] = os.environ.get('TESTS_BUILDDIR', 
+                os.path.dirname(__file__))
         self.settings = Gio.Settings('org.gnome.test')
         # we change the values in the tests, so set them to predictable start
         # value



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