Skip to content

Commit 0c5c850

Browse files
committed
Use reliable python interpreter path in tests
1 parent 47a6fdf commit 0c5c850

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_process.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_run_input_vs_stdin(self):
3939

4040
stdin_file = open(path)
4141
cmd = \
42-
"python -c \"import sys; assert(sys.stdin.read() == '{}')\""
42+
sys.executable + " -c \"import sys; assert(sys.stdin.read() == '{}')\""
4343

4444
# input is used in favor of stdin
4545
securesystemslib.process.run(cmd.format("use input kwarg"),
@@ -58,7 +58,7 @@ def test_run_input_vs_stdin(self):
5858
def test_run_duplicate_streams(self):
5959
"""Test output as streams and as returned. """
6060
# Command that prints 'foo' to stdout and 'bar' to stderr.
61-
cmd = ("python -c \""
61+
cmd = (sys.executable + " -c \""
6262
"import sys;"
6363
"sys.stdout.write('foo');"
6464
"sys.stderr.write('bar');\"")
@@ -102,7 +102,7 @@ def test_run_duplicate_streams(self):
102102

103103
def test_run_cmd_arg_return_code(self):
104104
"""Test command arg as string and list using return code. """
105-
cmd_str = ("python -c \""
105+
cmd_str = (sys.executable + " -c \""
106106
"import sys;"
107107
"sys.exit(100)\"")
108108
cmd_list = shlex.split(cmd_str)
@@ -118,7 +118,7 @@ def test_run_cmd_arg_return_code(self):
118118
def test_run_duplicate_streams_timeout(self):
119119
"""Test raise TimeoutExpired. """
120120
with self.assertRaises(securesystemslib.process.subprocess.TimeoutExpired):
121-
securesystemslib.process.run_duplicate_streams("python --version",
121+
securesystemslib.process.run_duplicate_streams(sys.executable + " --version",
122122
timeout=-1)
123123

124124

0 commit comments

Comments
 (0)