1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-10 12:58:35 +03:00

python/samba/tests: make sure samba-tool is called with ${PYTHON}

Ensure python scripts are called with the python version that
is defined by $PYTHON

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Noel Power 2018-09-27 16:08:34 +01:00 committed by Andrew Bartlett
parent 9f8a570f90
commit c8403f3360
2 changed files with 19 additions and 0 deletions

View File

@ -371,7 +371,10 @@ class BlackboxTestCase(TestCaseInTempDir):
bindir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../bin"))
parts = line.split(" ")
if os.path.exists(os.path.join(bindir, parts[0])):
cmd = parts[0]
parts[0] = os.path.join(bindir, parts[0])
if cmd == "samba-tool" and os.getenv("PYTHON", None):
parts = [os.environ["PYTHON"]] + parts
line = " ".join(parts)
return line

View File

@ -178,6 +178,10 @@ class SmbDotConfTests(TestCase):
self._test_empty(['bin/samba-tool', 'testparm'])
def _test_default(self, program):
if program[0] == 'bin/samba-tool' and os.getenv("PYTHON", None):
program = [os.environ["PYTHON"]] + program
failset = set()
count = 0
@ -216,6 +220,10 @@ class SmbDotConfTests(TestCase):
"Parameters that do not have matching defaults:"))
def _set_defaults(self, program):
if program[0] == 'bin/samba-tool' and os.getenv("PYTHON", None):
program = [os.environ["PYTHON"]] + program
failset = set()
count = 0
@ -254,6 +262,10 @@ class SmbDotConfTests(TestCase):
"Parameters that do not have matching defaults:"))
def _set_arbitrary(self, program, exceptions=None):
if program[0] == 'bin/samba-tool' and os.getenv("PYTHON", None):
program = [os.environ["PYTHON"]] + program
arbitrary = {'string': 'string', 'boolean': 'yes', 'integer': '5',
'boolean-rev': 'yes',
'cmdlist': 'a b c',
@ -377,6 +389,10 @@ class SmbDotConfTests(TestCase):
"Parameters that were unexpectedly not set:"))
def _test_empty(self, program):
if program[0] == 'bin/samba-tool' and os.getenv("PYTHON", None):
program = [os.environ["PYTHON"]] + program
p = subprocess.Popen(program + ["-s",
self.blankconf,
"--suppress-prompt"],