[pygobject] Fix GSchema tests for separate build tree



commit fbabc1fdafa1dcbd1f6aaea7b821bd1c64a546ab
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 9bc8cf8..fea1839 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -108,7 +108,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
 
 check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 29433f5..8e29e1f 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1365,7 +1365,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]