From 6d5fce6b2c2af7d6ff5c0115026846a9f013780e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 22 Jan 2019 08:25:03 +0100 Subject: build: Replace hard coded values for build time variables The test unit contains hard coded values for paths. However, these hard coded variables consider that the source code path and the build path are the same, something usual in autotools. These hard coded values has been replaced by build time variables that take the appropiate values considering different build paths. --- src/tests/Makefile.am | 4 +++- src/tests/tests.py.in | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index d641dc7..5f61ae1 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -6,7 +6,9 @@ EXTRA_DIST = tests.py.in CLEANFILES = $(check_SCRIPTS) tests.py: tests.py.in - $(AM_V_GEN) sed -e 's|@PYTHON[@]|$(PYTHON)|g' $< > $@ + $(AM_V_GEN) sed -e 's|@PYTHON[@]|$(PYTHON)|g' \ + -e 's|@DATA_DIR[@]|$(top_srcdir)/data|g' \ + -e 's|@SRC_DIR[@]|$(top_srcdir)|g' $< > $@ chmod +x $@ # Default pycodestyle --exclude + emacs backup files diff --git a/src/tests/tests.py.in b/src/tests/tests.py.in index 93cef12..35b1f55 100755 --- a/src/tests/tests.py.in +++ b/src/tests/tests.py.in @@ -3,7 +3,7 @@ import sys import os import tempfile -sys.path.insert(0, os.path.abspath(os.path.join(__file__, "../../"))) +sys.path.insert(0, os.path.abspath(os.path.join(__file__, "@SRC_DIR@"))) from gi.repository import Gtk from gi.repository import Gio @@ -35,7 +35,7 @@ XML = """ """ -DATA_DIR = os.path.abspath("../../data/") +DATA_DIR = os.path.abspath("@DATA_DIR@") class IntrospectionHelperTest(unittest.TestCase): -- cgit v1.2.1