From 2a79155be62fe4f284c7b4f973d03d79a48ea544 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sat, 9 May 2020 13:08:44 +0200 Subject: [PATCH] tests: override shebang to python2 --- tests/test_upload_script.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_upload_script.py b/tests/test_upload_script.py index 095b80e..2c5cb58 100644 --- a/tests/test_upload_script.py +++ b/tests/test_upload_script.py @@ -2,6 +2,7 @@ from __future__ import print_function +import sys import errno import os try: @@ -18,6 +19,8 @@ import random from configparser import ConfigParser from parameterized import parameterized +PY2 = sys.version_info.major == 2 + # Path to the actual CGI script that should be tested CGI_SCRIPT = os.path.join(os.path.dirname(__file__), '../src/web/upload.cgi') @@ -257,6 +260,9 @@ def _copy_tweak(source_file, dest_file, topdir): with open(source_file) as source: with open(dest_file, 'w') as dest: for line in source: + if PY2 and line == "#!/usr/bin/python3\n": + line = line.replace("python3", "python2") + m = regex.match(line) if m: line = "%s = '%s%s'\n" % (m.group(1), topdir, m.group(2))