From e9d3a7bb136c6533f15f857b0c07c551378a614f Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 14 Nov 2023 12:20:57 +0000 Subject: [PATCH] test: Ignore 'OS_' environment variables Our functional tests are inherently dependent on 'clouds.yaml' files. The presence of 'OS_*' environment variables can cause weird test failures. Simply don't pass them through to our test environment. Change-Id: I7d24cdff5f1f5798118816b12d7398b87a5f5ed4 Signed-off-by: Stephen Finucane --- openstackclient/tests/functional/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openstackclient/tests/functional/base.py b/openstackclient/tests/functional/base.py index 18ff65baf1..ea135d8af2 100644 --- a/openstackclient/tests/functional/base.py +++ b/openstackclient/tests/functional/base.py @@ -30,8 +30,11 @@ def execute(cmd, *, fail_ok=False): cmdlist = shlex.split(cmd) stdout = subprocess.PIPE stderr = subprocess.PIPE + env = { + k: v for k, v in os.environ.copy().items() if not k.startswith('OS_') + } - proc = subprocess.Popen(cmdlist, stdout=stdout, stderr=stderr) + proc = subprocess.Popen(cmdlist, stdout=stdout, stderr=stderr, env=env) result_out, result_err = proc.communicate() result_out = result_out.decode('utf-8')