Skip to content

Commit 908a78d

Browse files
committed
tests: make the command tests work when python is not the one in the shebang
We test a couple ways of running the meson command, and double check that the debug logs record the meson command used (including python). But when running the meson command as an executable instead of as a python script, we see whichever version `env` in the shebang sees. Fix this by mocking the python command as well.
1 parent 174e05d commit 908a78d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

run_meson_command_tests.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,17 @@ def test_meson_uninstalled(self):
132132
bindir = (self.tmpdir / 'bin')
133133
bindir.mkdir()
134134
(bindir / 'meson').symlink_to(self.src_root / 'meson.py')
135+
(bindir / 'python3').symlink_to(python_command[0])
135136
os.environ['PATH'] = str(bindir) + os.pathsep + os.environ['PATH']
137+
# use our overridden PATH-compatible python
138+
path_resolved_meson_command = resolved_meson_command.copy()
139+
path_resolved_meson_command[0] = str(bindir / 'python3')
136140
# See if it works!
137141
meson_py = 'meson'
138142
meson_setup = [meson_py, 'setup']
139143
meson_command = meson_setup + self.meson_args
140144
stdo = self._run(meson_command + [self.testdir, builddir])
141-
self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
145+
self.assertMesonCommandIs(stdo.split('\n')[0], path_resolved_meson_command)
142146

143147
def test_meson_installed(self):
144148
# Install meson

0 commit comments

Comments
 (0)