From 0f79cefb60170653a6ee81843dfa4d0ab703cb26 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 7 Apr 2021 20:59:13 +0200 Subject: [PATCH] tests: Use current python interpreter for sub tests Applied-Upstream: https://github.com/theupdateframework/tuf/pull/1337 Relate-to: https://github.com/theupdateframework/python-tuf/issues/263 Signed-off-by: Philippe Coval --- ...ent-python-interpreter-for-sub-tests.patch | 35 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 36 insertions(+) create mode 100644 debian/patches/0005-tests-Use-current-python-interpreter-for-sub-tests.patch diff --git a/debian/patches/0005-tests-Use-current-python-interpreter-for-sub-tests.patch b/debian/patches/0005-tests-Use-current-python-interpreter-for-sub-tests.patch new file mode 100644 index 0000000000..c55fe43613 --- /dev/null +++ b/debian/patches/0005-tests-Use-current-python-interpreter-for-sub-tests.patch @@ -0,0 +1,35 @@ +From: Philippe Coval +Date: Wed, 7 Apr 2021 13:02:34 +0200 +Subject: tests: Use current python interpreter for sub tests + +Can be useful to run tests using distro runtimes, +(like python3 on Debian). + +Relate-to: https://github.com/theupdateframework/tuf/issues/263 +Forwarded: https://github.com/theupdateframework/tuf/pull/1337 +Signed-off-by: Philippe Coval +--- + tests/utils.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/utils.py b/tests/utils.py +index 8e8c07b..df43a23 100644 +--- a/tests/utils.py ++++ b/tests/utils.py +@@ -25,6 +25,7 @@ from contextlib import contextmanager + import errno + import logging + import socket ++import sys + import time + import subprocess + import threading +@@ -200,7 +201,7 @@ class TestServerProcess(): + """Starts the process running the server.""" + + # The "-u" option forces stdin, stdout and stderr to be unbuffered. +- command = ['python', '-u', self.server] + extra_cmd_args ++ command = [sys.executable, '-u', self.server] + extra_cmd_args + + # Reusing one subprocess in multiple tests, but split up the logs for each. + self.__server_process = subprocess.Popen(command, diff --git a/debian/patches/series b/debian/patches/series index f4dbf05e9a..f0e1a87d8f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ 0002-test-Use-python3-coverage-from-sitepackages.patch 0003-ci-Remove-workaround-for-pip-resolver-issue.patch 0004-debian-patches-Use-python3-explicitly.patch +0005-tests-Use-current-python-interpreter-for-sub-tests.patch