diff --git a/Makefile b/Makefile index 4b31a51..9c4ce7b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,17 @@ -PYTHON = python3.8 - +.POSIX: .PHONY: test unittest pre-clean clean +# +# On systems where Python 3.x binary has a different name, just +# overwrite the name/path on the command line, like: +# +# make test PYTHON=/usr/local/bin/python3.8 +# +# This marco is passed via environment to test/e2e_test.py, where it's +# used to compute further commands. +# +PYTHON = python3 + # # Run a set of end-to-end tests. # diff --git a/test/e2e.ini b/test/e2e.ini index 8ad8577..134a005 100644 --- a/test/e2e.ini +++ b/test/e2e.ini @@ -31,7 +31,6 @@ certs: test/certs [tests] # Number of "test-*" sections in this file, describing test cases. cases: 6 -python_path: /usr/local/bin/python3.8 e2e_log: test/logs/e2e.log e2e_log_format: %(asctime)s %(pathname)s:%(lineno)d %(levelname)s [%(funcName)s] %(message)s e2e_log_datefmt: %Y-%m-%d %H:%M:%S diff --git a/test/e2e_test.py b/test/e2e_test.py index d04216a..a3617d6 100644 --- a/test/e2e_test.py +++ b/test/e2e_test.py @@ -88,13 +88,15 @@ def execute_e2e_test(case_name, config, config_path): config file. Each of these sections should contain following properties: 'descr', 'to', 'in' and 'out'. """ + # This environment variable is set in Makefile. + python_path = os.getenv('PYTHON', 'python3') test_command = "GPG_MAILGATE_CONFIG=%s %s gpg-mailgate.py %s < %s" % ( config_path, - config.get("tests", "python_path"), + python_path, config.get(case_name, "to"), config.get(case_name, "in")) - result_command = "%s %s %d" % (config.get("tests", "python_path"), config.get("relay", "script"), config.getint("relay", "port")) + result_command = "%s %s %d" % (python_path, config.get("relay", "script"), config.getint("relay", "port")) logging.debug("Spawning relay: '%s'" % (result_command)) pipe = os.popen(result_command, 'r')