Description: Use python3 in tests Some upstream tests call the python interpreter in a subprocess, e.g. to test the custom `process` module or to run simple in-toto step or inspection commands. 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. Forwarded: not-needed Origin: upstream, https://github.com/in-toto/in-toto/commit/a7f4baf8d0186fa4a6314264707f4d5d1b3cecdc Index: in_toto-1.4.0/tests/demo_files/demo.layout.template =================================================================== --- in_toto-1.4.0.orig/tests/demo_files/demo.layout.template +++ in_toto-1.4.0/tests/demo_files/demo.layout.template @@ -25,7 +25,7 @@ ], "name": "untar", "run": [ - "python", + "python3", "./scripts/tar", "xfz", "foo.tar.gz" Index: in_toto-1.4.0/tests/test_in_toto_mock.py =================================================================== --- in_toto-1.4.0.orig/tests/test_in_toto_mock.py +++ in_toto-1.4.0/tests/test_in_toto_mock.py @@ -73,7 +73,7 @@ class TestInTotoMockTool(CliTestCase, Tm def test_main_required_args(self): """Test CLI command with required arguments.""" - args = ["--name", self.test_step, "--", "python", "--version"] + args = ["--name", self.test_step, "--", "python3", "--version"] self.assert_cli_sys_exit(args, 0) self.assertTrue(os.path.exists(self.test_link)) Index: in_toto-1.4.0/tests/test_in_toto_run.py =================================================================== --- in_toto-1.4.0.orig/tests/test_in_toto_run.py +++ in_toto-1.4.0/tests/test_in_toto_run.py @@ -90,7 +90,7 @@ class TestInTotoRunTool(CliTestCase, TmpDirMixin, GPGKeysMixin, GenKeysMixin): "--key", self.rsa_key_path, "--", - "python", + "python3", "--version", ] @@ -111,7 +111,7 @@ class TestInTotoRunTool(CliTestCase, TmpDirMixin, GPGKeysMixin, GenKeysMixin): self.test_artifact, "--record-streams", ] - positional_args = ["--", "python", "--version"] + positional_args = ["--", "python3", "--version"] # Test and assert recorded artifacts args1 = named_args + positional_args @@ -171,7 +171,7 @@ class TestInTotoRunTool(CliTestCase, TmpDirMixin, GPGKeysMixin, GenKeysMixin): "--metadata-directory", tmp_dir, "--", - "python", + "python3", "--version", ] @@ -230,7 +230,7 @@ class TestInTotoRunTool(CliTestCase, TmpDirMixin, GPGKeysMixin, GenKeysMixin): "--key-type", key_type, ] - cmd = ["--", "python", "--version"] + cmd = ["--", "python3", "--version"] # Make sure the link file to be generated doesn't already exist self.assertFalse(os.path.exists(link_path)) @@ -262,7 +262,7 @@ class TestInTotoRunTool(CliTestCase, TmpDirMixin, GPGKeysMixin, GenKeysMixin): "--gpg-home", self.gnupg_home, "--", - "python", + "python3", "--version", ] @@ -282,7 +282,7 @@ class TestInTotoRunTool(CliTestCase, TmpDirMixin, GPGKeysMixin, GenKeysMixin): "--gpg-home", self.gnupg_home, "--", - "python", + "python3", "--version", ] @@ -417,7 +417,7 @@ class TestInTotoRunToolWithDSSE( self.rsa_key_path, "--use-dsse", "--", - "python", + "python3", "--version", ] @@ -439,7 +439,7 @@ class TestInTotoRunToolWithDSSE( "--record-streams", "--use-dsse", ] - positional_args = ["--", "python", "--version"] + positional_args = ["--", "python3", "--version"] # Test and assert recorded artifacts args1 = named_args + positional_args @@ -491,7 +491,7 @@ class TestInTotoRunToolWithDSSE( self.gnupg_home, "--use-dsse", "--", - "python", + "python3", "--version", ] Index: in_toto-1.4.0/tests/test_runlib.py =================================================================== --- in_toto-1.4.0.orig/tests/test_runlib.py +++ in_toto-1.4.0/tests/test_runlib.py @@ -755,13 +755,13 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): def test_in_toto_run_verify_signature(self): """Successfully run, verify signed metadata.""" link = in_toto_run( - self.step_name, None, None, ["python", "--version"], True, self.key + self.step_name, None, None, ["python3", "--version"], True, self.key ) link.verify_signature(self.key) def test_in_toto_run_no_signature(self): """Successfully run, verify empty signature field.""" - link = in_toto_run(self.step_name, None, None, ["python", "--version"]) + link = in_toto_run(self.step_name, None, None, ["python3", "--version"]) self.assertFalse(len(link.signatures)) def test_in_toto_run_with_byproduct(self): @@ -770,7 +770,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], record_streams=True, ) @@ -792,7 +792,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], record_streams=False, ) self.assertFalse(len(link.signed.byproducts.get("stdout"))) @@ -803,7 +803,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, [self.test_artifact], [self.test_artifact], - ["python", "--version"], + ["python3", "--version"], True, self.key, ) @@ -822,7 +822,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, [self.test_artifact], [self.test_artifact], - ["python", "--version"], + ["python3", "--version"], True, self.key, metadata_directory=tmp_dir, @@ -844,7 +844,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, [self.test_artifact], [self.test_artifact], - ["python", "--version"], + ["python3", "--version"], True, self.key, metadata_directory=tmp_dir, @@ -861,7 +861,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, [self.test_artifact], [self.test_artifact], - ["python", "--version"], + ["python3", "--version"], True, self.key, ) @@ -880,7 +880,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, [self.test_artifact], [self.test_artifact], - ["python", "--version"], + ["python3", "--version"], ) self.assertEqual( list(link.signed.materials.keys()), @@ -894,7 +894,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, [], [], - ["python", "--version"], + ["python3", "--version"], record_environment=True, ) self.assertEqual( @@ -918,7 +918,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, paths, paths, - ["python", "--version"], + ["python3", "--version"], normalize_line_endings=True, ).signed @@ -939,7 +939,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], True, "this-is-not-a-key", ) @@ -951,7 +951,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], True, self.key_pub, ) @@ -963,7 +963,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], True, self.key, metadata_directory="nonexistentDir", @@ -980,7 +980,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], True, self.key, metadata_directory=path, @@ -998,7 +998,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], True, self.key, metadata_directory=tmp_dir, @@ -1012,7 +1012,7 @@ class TestInTotoRun(unittest.TestCase, TmpDirMixin): self.step_name, None, None, - ["python", "--version"], + ["python3", "--version"], True, self.key, use_dsse=True, Index: in_toto-1.4.0/tests/test_verifylib.py =================================================================== --- in_toto-1.4.0.orig/tests/test_verifylib.py +++ in_toto-1.4.0/tests/test_verifylib.py @@ -129,7 +129,7 @@ class TestRunAllInspections(unittest.TestCase, TmpDirMixin): { "name": "touch-bar", "run": [ - "python", + "python3", os.path.join(scripts_directory, "touch"), "bar", ], @@ -174,7 +174,7 @@ class TestRunAllInspections(unittest.TestCase, TmpDirMixin): "inspect": [ { "name": "non-zero-inspection", - "run": ["python", "./scripts/expr", "1", "/", "0"], + "run": ["python3", "./scripts/expr", "1", "/", "0"], } ], } @@ -990,7 +990,7 @@ class TestInTotoVerify(unittest.TestCase, TmpDirMixin): # dump layout with failing inspection retval layout = copy.deepcopy(layout_template) layout.signed.inspect[0].run = [ - "python", + "python3", "./scripts/expr", "1", "/",