From 4717a58f6ceb40f2fb3d990191f86d18283146b8 Mon Sep 17 00:00:00 2001 From: Rob van der Linde Date: Thu, 23 Feb 2023 15:51:48 +1300 Subject: [PATCH] selftest: fix mutable default arguments Signed-off-by: Rob van der Linde Reviewed-by: Andrew Bartlett Reviewed-by: Joseph Sutton --- selftest/selftesthelpers.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py index 0320008faf9..951eeb4d1b5 100644 --- a/selftest/selftesthelpers.py +++ b/selftest/selftesthelpers.py @@ -66,13 +66,15 @@ def valgrindify(cmdline): return valgrind + " " + cmdline -def plantestsuite(name, env, cmd, environ={}): +def plantestsuite(name, env, cmd, environ=None): """Plan a test suite. :param name: Testsuite name :param env: Environment to run the testsuite in :param cmdline: Command line to run """ + if environ is None: + environ = {} print("-- TEST --") if env == "none": fullname = name @@ -149,7 +151,13 @@ def planperltestsuite(name, path): skiptestsuite(name, "Test::More not available") -def planpythontestsuite(env, module, name=None, extra_path=[], environ={}, extra_args=[]): +def planpythontestsuite(env, module, name=None, extra_path=None, environ=None, extra_args=None): + if extra_path is None: + extra_path = [] + if environ is None: + environ = {} + if extra_args is None: + extra_args = [] environ = dict(environ) py_path = list(extra_path) if py_path is not None: @@ -192,7 +200,9 @@ smbtorture4_options = [ ] + get_env_torture_options() -def plansmbtorture4testsuite(name, env, options, target, modname=None, environ={}): +def plansmbtorture4testsuite(name, env, options, target, modname=None, environ=None): + if environ is None: + environ = {} if modname is None: modname = "samba4.%s" % name if isinstance(options, list):