mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-29 18:36:38 +02:00
testprogramrunner: enable setting cwd
Add a mechanism to change the current working directory the program under test is being run from.
This commit is contained in:
@@ -104,6 +104,7 @@ class TestProgramRunner(unittest.TestCase):
|
|||||||
timeout_seconds=10,
|
timeout_seconds=10,
|
||||||
wrapper_args=[],
|
wrapper_args=[],
|
||||||
environment={},
|
environment={},
|
||||||
|
cwd=None,
|
||||||
) -> Result:
|
) -> Result:
|
||||||
argv = [self.__program]
|
argv = [self.__program]
|
||||||
|
|
||||||
@@ -123,6 +124,9 @@ class TestProgramRunner(unittest.TestCase):
|
|||||||
|
|
||||||
print("Running:", argv)
|
print("Running:", argv)
|
||||||
|
|
||||||
|
if cwd is not None:
|
||||||
|
print("Working Directory:", cwd)
|
||||||
|
|
||||||
# We want to ensure consistent line endings...
|
# We want to ensure consistent line endings...
|
||||||
info = subprocess.run(
|
info = subprocess.run(
|
||||||
argv,
|
argv,
|
||||||
@@ -134,6 +138,7 @@ class TestProgramRunner(unittest.TestCase):
|
|||||||
text=True,
|
text=True,
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
check=False,
|
check=False,
|
||||||
|
cwd=cwd,
|
||||||
)
|
)
|
||||||
|
|
||||||
result = Result(
|
result = Result(
|
||||||
|
Reference in New Issue
Block a user