1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

selftesthelpers: fix py3 tests with extra_path

If a test was supplied with extra_path, a PYTHONPATH= env variable was
prepended to the args list, but the py3_compatible clause assumed the
first args element was /usr/bin/python.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <noel.power@suse.com>
This commit is contained in:
Douglas Bagnall 2018-10-28 10:53:49 +13:00 committed by Douglas Bagnall
parent f17a77af46
commit 1cf142c30a

View File

@ -136,18 +136,21 @@ def planperltestsuite(name, path):
skiptestsuite(name, "Test::More not available")
def planpythontestsuite(env, module, name=None, extra_path=[], py3_compatible=False):
def planpythontestsuite(env, module, name=None, extra_path=None,
py3_compatible=False):
if name is None:
name = module
pypath = list(extra_path)
args = [python, "-m", "samba.subunit.run", "$LISTOPT", "$LOADLIST", module]
if pypath:
args.insert(0, "PYTHONPATH=%s" % ":".join(["$PYTHONPATH"] + pypath))
plantestsuite_loadlist(name, env, args)
if extra_path:
pypath = ["PYTHONPATH=$PYTHONPATH:%s" % ":".join(extra_path)]
else:
pypath = []
plantestsuite_loadlist(name, env, pypath + args)
if py3_compatible and extra_python is not None:
# Plan one more test for Python 3 compatible module
args[0] = extra_python
plantestsuite_loadlist(name + ".python3", env, args)
plantestsuite_loadlist(name + ".python3", env, pypath + args)
def get_env_torture_options():