9 "sys.platform[:5] == 'win32'",
10 reason
="The hybrid sh/Python dotbot script doesn't run on Windows platforms",
12 @pytest.mark
.parametrize("python_name", (None, "python", "python3"))
13 def test_find_python_executable(python_name
, home
, dotfiles
):
14 """Verify that the sh/Python hybrid dotbot executable can find Python."""
16 dotfiles
.write_config([])
17 dotbot_executable
= os
.path
.join(
18 os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))), "bin", "dotbot"
21 # Create a link to sh.
22 tmp_bin
= os
.path
.join(home
, "tmp_bin")
24 sh_path
= shutil
.which("sh")
25 os
.symlink(sh_path
, os
.path
.join(tmp_bin
, "sh"))
28 with
open(os
.path
.join(tmp_bin
, python_name
), "w") as file:
29 file.write("#!" + tmp_bin
+ "/sh\n")
30 file.write("exit 0\n")
31 os
.chmod(os
.path
.join(tmp_bin
, python_name
), 0o777)
32 env
= dict(os
.environ
)
36 subprocess
.check_call(
37 [dotbot_executable
, "-c", dotfiles
.config_filename
],
41 with pytest
.raises(subprocess
.CalledProcessError
):
42 subprocess
.check_call(
43 [dotbot_executable
, "-c", dotfiles
.config_filename
],