From 8f8b0fd12a72630d6340ad976eccb431d265e4d0 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 19 Oct 2016 20:51:47 +0200 Subject: python: selftesthelpers: Add possibility for planning tests for 'extra_python' (Python 3). This change allows us to mark modules which are Python 3 compatible with the keyword argument `py3_compatible`. Then, if building with Python 3 is configured using --extra-python, `planpythontestsuite` will plan an extra Python test for each marked module. Signed-off-by: Lumir Balhar Reviewed-by: Andrew Bartlett Reviewed-by: Garming Sam --- selftest/selftesthelpers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py index 495a0b7a922..1a1e080b12b 100644 --- a/selftest/selftesthelpers.py +++ b/selftest/selftesthelpers.py @@ -46,6 +46,7 @@ else: has_perl_test_more = False python = os.getenv("PYTHON", "python") +extra_python = os.getenv("EXTRA_PYTHON", "python3") tap2subunit = python + " " + os.path.join(srcdir(), "selftest", "tap2subunit") @@ -124,7 +125,7 @@ def planperltestsuite(name, path): skiptestsuite(name, "Test::More not available") -def planpythontestsuite(env, module, name=None, extra_path=[]): +def planpythontestsuite(env, module, name=None, extra_path=[], py3_compatible=False): if name is None: name = module pypath = list(extra_path) @@ -132,6 +133,10 @@ def planpythontestsuite(env, module, name=None, extra_path=[]): if pypath: args.insert(0, "PYTHONPATH=%s" % ":".join(["$PYTHONPATH"] + pypath)) plantestsuite_loadlist(name, env, args) + if py3_compatible: + # Plan one more test for Python 3 compatible module + args[0] = extra_python + plantestsuite_loadlist(name, env, args) def get_env_torture_options(): -- cgit v1.2.1