From aae38715e31c0c69f615fa9cf7c3c58e6f206b22 Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Tue, 21 Nov 2023 13:12:30 +0100 Subject: [PATCH] Explicitly set pythonpath for sudo --- tests/integration/pping_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/pping_test.py b/tests/integration/pping_test.py index 6152e34cfa..b3ee67a59e 100644 --- a/tests/integration/pping_test.py +++ b/tests/integration/pping_test.py @@ -2,6 +2,7 @@ various pping integration tests """ import os +import sys from pathlib import Path import getpass from shutil import which @@ -76,7 +77,8 @@ def get_root_method(): if os.geteuid() == 0: return [] elif os.system("sudo true") == 0: - return ["sudo", "-E"] + pythonpath = ":".join(sys.path) + return ["sudo", "-E", "PYTHONPATH=%s" % pythonpath] elif os.system("gosu root true") == 0: return ["gosu", "root"] else: