[d-feet/enable-gitlab-ci: 1/6] Run tests with same Python version as application
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [d-feet/enable-gitlab-ci: 1/6] Run tests with same Python version as application
- Date: Wed, 19 Sep 2018 10:07:46 +0000 (UTC)
commit 520a529f3b4277127843454c6d5ec40cceb2755d
Author: Will Thompson <will willthompson co uk>
Date: Wed Sep 19 10:42:23 2018 +0100
Run tests with same Python version as application
Since c28acbf326bb79543b285f371bdf068d8831d9a7 the application has used
the Python version detected at configure time, but tests were still
unconditionally run with the system version of Python 2. This made it
impossible to run the tests on systems with only Python 3.
.gitignore | 1 +
src/tests/Makefile.am | 6 +++++-
src/tests/{tests.py => tests.py.in} | 3 ++-
3 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 4bda0ea..113516e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,4 +49,5 @@ po/stamp-it
po/*.gmo
py-compile
src/d-feet
+src/tests/tests.py
test-driver
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index d8c2f03..14761b2 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -2,8 +2,12 @@ TESTS = tests.py
check_SCRIPTS = tests.py
-EXTRA_DIST = tests.py
+EXTRA_DIST = tests.py.in
+CLEANFILES = $(check_SCRIPTS)
+tests.py: tests.py.in
+ $(AM_V_GEN) sed -e 's|@PYTHON[@]|$(PYTHON)|g' $< > $@
+ chmod +x $@
# Default pep8.py --exclude + emacs backup files
PEP8_EXCLUDES=--exclude='.svn,CVS,.bzr,.hg,.git,__pycache__,.\#*'
diff --git a/src/tests/tests.py b/src/tests/tests.py.in
similarity index 99%
rename from src/tests/tests.py
rename to src/tests/tests.py.in
index 31a7292..152bef3 100755
--- a/src/tests/tests.py
+++ b/src/tests/tests.py.in
@@ -1,4 +1,5 @@
-#!/usr/bin/env python
+#!@PYTHON@
+# -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(__file__, "../../")))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]