tests/lib/testprogramrunner: Support overriding the environment

This commit is contained in:
Marco Trevisan (Treviño) 2025-02-06 22:58:01 +01:00
parent 044e77a384
commit fe25e4aad5

View File

@ -98,7 +98,12 @@ class TestProgramRunner(unittest.TestCase):
print("tmpdir:", self.tmpdir.name) print("tmpdir:", self.tmpdir.name)
def runTestProgram( def runTestProgram(
self, *args, should_fail=False, timeout_seconds=10, wrapper_args=[] self,
*args,
should_fail=False,
timeout_seconds=10,
wrapper_args=[],
environment={},
) -> Result: ) -> Result:
argv = [self.__program] argv = [self.__program]
@ -114,6 +119,7 @@ class TestProgramRunner(unittest.TestCase):
env = os.environ.copy() env = os.environ.copy()
env["LC_ALL"] = "C.UTF-8" env["LC_ALL"] = "C.UTF-8"
env["G_DEBUG"] = "fatal-warnings" env["G_DEBUG"] = "fatal-warnings"
env.update(environment)
print("Running:", argv) print("Running:", argv)