|
8 | 8 |
|
9 | 9 | from manage.scriptutils import ( |
10 | 10 | find_install_from_script, |
| 11 | + _find_shebang_command, |
11 | 12 | _read_script, |
12 | 13 | NewEncoding, |
13 | 14 | _maybe_quote, |
@@ -69,6 +70,25 @@ def test_read_shebang(fake_config, tmp_path, script, expect): |
69 | 70 | assert not expect |
70 | 71 |
|
71 | 72 |
|
| 73 | +def test_default_py_shebang(fake_config, tmp_path): |
| 74 | + inst = _fake_install("1.0", company="PythonCore", prefix=PurePath("C:\\TestRoot"), default=True) |
| 75 | + inst["run-for"] = [ |
| 76 | + dict(name="python.exe", target=".\\python.exe"), |
| 77 | + dict(name="pythonw.exe", target=".\\pythonw.exe", windowed=1), |
| 78 | + ] |
| 79 | + fake_config.installs[:] = [inst] |
| 80 | + |
| 81 | + # Finds the install's default executable |
| 82 | + assert _find_shebang_command(fake_config, "python")["executable"].match("test-binary-1.0.exe") |
| 83 | + assert _find_shebang_command(fake_config, "py")["executable"].match("test-binary-1.0.exe") |
| 84 | + assert _find_shebang_command(fake_config, "python1.0")["executable"].match("test-binary-1.0.exe") |
| 85 | + # Finds the install's run-for executable with windowed=1 |
| 86 | + assert _find_shebang_command(fake_config, "pythonw")["executable"].match("pythonw.exe") |
| 87 | + assert _find_shebang_command(fake_config, "pyw")["executable"].match("pythonw.exe") |
| 88 | + assert _find_shebang_command(fake_config, "pythonw1.0")["executable"].match("pythonw.exe") |
| 89 | + |
| 90 | + |
| 91 | + |
72 | 92 | @pytest.mark.parametrize("script, expect", [ |
73 | 93 | ("# not a coding comment", None), |
74 | 94 | ("# coding: utf-8-sig", None), |
|
0 commit comments