From: Douglas Bagnall Date: Sat, 27 Oct 2018 21:53:49 +0000 (+1300) Subject: selftesthelpers: fix py3 tests with extra_path X-Git-Tag: tdb-1.3.17~976 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cf142c30abaec2e99cebca15ac61685723032ed;p=thirdparty%2Fsamba.git 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 Reviewed-by: Noel Power --- diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py index 25977efe111..b0fc79bd18e 100644 --- a/selftest/selftesthelpers.py +++ b/selftest/selftesthelpers.py @@ -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():