@@ -105,7 +105,7 @@ def test_runtime_version_fail_module(mocker: MockerFixture) -> None:
105105def test_runtime_version_fail_cli (mocker : MockerFixture ) -> None :
106106 """Tests for failure to detect Ansible version."""
107107 mocker .patch (
108- "ansible_compat.runtime.Runtime.exec " ,
108+ "ansible_compat.runtime.Runtime.run " ,
109109 return_value = CompletedProcess (
110110 ["x" ],
111111 returncode = 123 ,
@@ -152,7 +152,7 @@ def test_runtime_install_role(
152152 runtime = Runtime (isolated = isolated , project_dir = project_dir )
153153 runtime .prepare_environment (install_local = True )
154154 # check that role appears as installed now
155- result = runtime .exec (["ansible-galaxy" , "list" ])
155+ result = runtime .run (["ansible-galaxy" , "list" ])
156156 assert result .returncode == 0 , result
157157 assert role_name in result .stdout
158158 if isolated :
@@ -573,7 +573,7 @@ def test_install_galaxy_role_no_checks(runtime_tmp: Runtime) -> None:
573573""" ,
574574 )
575575 runtime_tmp ._install_galaxy_role (runtime_tmp .project_dir , role_name_check = 2 )
576- result = runtime_tmp .exec (["ansible-galaxy" , "list" ])
576+ result = runtime_tmp .run (["ansible-galaxy" , "list" ])
577577 assert "- acme.foo," in result .stdout
578578 assert result .returncode == 0 , result
579579
@@ -658,7 +658,7 @@ def test_install_collection_from_disk(path: str, scenario: str) -> None:
658658 runtime .prepare_environment (install_local = True )
659659 # that molecule converge playbook can be used without molecule and
660660 # should validate that the installed collection is available.
661- result = runtime .exec (["ansible-playbook" , f"molecule/{ scenario } /converge.yml" ])
661+ result = runtime .run (["ansible-playbook" , f"molecule/{ scenario } /converge.yml" ])
662662 assert result .returncode == 0 , result .stdout
663663 runtime .clean ()
664664
@@ -691,8 +691,8 @@ def test_prepare_environment_offline_role() -> None:
691691
692692def test_runtime_run (runtime : Runtime ) -> None :
693693 """Check if tee and non tee mode return same kind of results."""
694- result1 = runtime .exec (["seq" , "10" ])
695- result2 = runtime .exec (["seq" , "10" ], tee = True )
694+ result1 = runtime .run (["seq" , "10" ])
695+ result2 = runtime .run (["seq" , "10" ], tee = True )
696696 assert result1 .returncode == result2 .returncode
697697 assert result1 .stderr == result2 .stderr
698698 assert result1 .stdout == result2 .stdout
@@ -701,20 +701,20 @@ def test_runtime_run(runtime: Runtime) -> None:
701701def test_runtime_exec_cwd (runtime : Runtime ) -> None :
702702 """Check if passing cwd works as expected."""
703703 path = Path ("/" )
704- result1 = runtime .exec (["pwd" ], cwd = path )
705- result2 = runtime .exec (["pwd" ])
704+ result1 = runtime .run (["pwd" ], cwd = path )
705+ result2 = runtime .run (["pwd" ])
706706 assert result1 .stdout .rstrip () == str (path )
707707 assert result1 .stdout != result2 .stdout
708708
709709
710710def test_runtime_exec_env (runtime : Runtime ) -> None :
711711 """Check if passing env works."""
712- result = runtime .exec (["printenv" , "FOO" ])
712+ result = runtime .run (["printenv" , "FOO" ])
713713 assert not result .stdout
714714
715- result = runtime .exec (["printenv" , "FOO" ], env = {"FOO" : "bar" })
715+ result = runtime .run (["printenv" , "FOO" ], env = {"FOO" : "bar" })
716716 assert result .stdout .rstrip () == "bar"
717717
718718 runtime .environ ["FOO" ] = "bar"
719- result = runtime .exec (["printenv" , "FOO" ])
719+ result = runtime .run (["printenv" , "FOO" ])
720720 assert result .stdout .rstrip () == "bar"
0 commit comments