Skip to content

Commit

Permalink
Merge pull request #403 from AMDmi3/fix-tests
Browse files Browse the repository at this point in the history
Use reliable python interpreter path in tests
  • Loading branch information
adityasaky authored Apr 26, 2022
2 parents 47a6fdf + 0c5c850 commit d64badd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_run_input_vs_stdin(self):

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

# input is used in favor of stdin
securesystemslib.process.run(cmd.format("use input kwarg"),
Expand All @@ -58,7 +58,7 @@ def test_run_input_vs_stdin(self):
def test_run_duplicate_streams(self):
"""Test output as streams and as returned. """
# Command that prints 'foo' to stdout and 'bar' to stderr.
cmd = ("python -c \""
cmd = (sys.executable + " -c \""
"import sys;"
"sys.stdout.write('foo');"
"sys.stderr.write('bar');\"")
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_run_duplicate_streams(self):

def test_run_cmd_arg_return_code(self):
"""Test command arg as string and list using return code. """
cmd_str = ("python -c \""
cmd_str = (sys.executable + " -c \""
"import sys;"
"sys.exit(100)\"")
cmd_list = shlex.split(cmd_str)
Expand All @@ -118,7 +118,7 @@ def test_run_cmd_arg_return_code(self):
def test_run_duplicate_streams_timeout(self):
"""Test raise TimeoutExpired. """
with self.assertRaises(securesystemslib.process.subprocess.TimeoutExpired):
securesystemslib.process.run_duplicate_streams("python --version",
securesystemslib.process.run_duplicate_streams(sys.executable + " --version",
timeout=-1)


Expand Down

0 comments on commit d64badd

Please sign in to comment.