Remove hardcoded python3.8 path
- Let the user overwrite Python binary name while calling make. - Use environment variable set by make to instruct e2e_test.py which binary it should call to execute Python code.
This commit is contained in:
parent
5a8d2c0108
commit
c81c6e6e0d
3 changed files with 16 additions and 5 deletions
14
Makefile
14
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.
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue