47 lines
1.9 KiB
Diff
47 lines
1.9 KiB
Diff
|
Description: Use python3 in tests
|
||
|
Some upstream tests for the custom `process` module call the python interpreter
|
||
|
in a subprocess. In Debian, where we only build for python3, "python" is not
|
||
|
available during build and thus makes those tests fail. This patch replaces
|
||
|
"python" with "python3" where applicable.
|
||
|
Author: Lukas Puehringer <lukas.puehringer@nyu.edu>
|
||
|
Forwarded: not-needed
|
||
|
|
||
|
--- python-securesystemslib-0.16.0.orig/tests/test_process.py
|
||
|
+++ python-securesystemslib-0.16.0/tests/test_process.py
|
||
|
@@ -38,7 +38,7 @@ class Test_Process(unittest.TestCase):
|
||
|
|
||
|
stdin_file = open(path)
|
||
|
cmd = \
|
||
|
- "python -c \"import sys; assert(sys.stdin.read() == '{}')\""
|
||
|
+ "python3 -c \"import sys; assert(sys.stdin.read() == '{}')\""
|
||
|
|
||
|
# input is used in favor of stdin
|
||
|
securesystemslib.process.run(cmd.format("use input kwarg"),
|
||
|
@@ -57,7 +57,7 @@ class Test_Process(unittest.TestCase):
|
||
|
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 = ("python3 -c \""
|
||
|
"import sys;"
|
||
|
"sys.stdout.write('foo');"
|
||
|
"sys.stderr.write('bar');\"")
|
||
|
@@ -101,7 +101,7 @@ class Test_Process(unittest.TestCase):
|
||
|
|
||
|
def test_run_cmd_arg_return_code(self):
|
||
|
"""Test command arg as string and list using return code. """
|
||
|
- cmd_str = ("python -c \""
|
||
|
+ cmd_str = ("python3 -c \""
|
||
|
"import sys;"
|
||
|
"sys.exit(100)\"")
|
||
|
cmd_list = shlex.split(cmd_str)
|
||
|
@@ -117,7 +117,7 @@ class Test_Process(unittest.TestCase):
|
||
|
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("python3 --version",
|
||
|
timeout=-1)
|
||
|
|
||
|
|