aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-11-17 01:43:44 -0500
committerNirbheek Chauhan <nirbheek@centricular.com>2022-11-21 15:43:52 +0530
commitd2bcb6e06f2c90f7aec46423c8624055fce26205 (patch)
tree4cefa12c3ece2128e8ee8b43e2f7b052340fee5b
parente69d92240868d0b113a9400e5d0270876bdb4549 (diff)
downloadmeson-d2bcb6e06f2c90f7aec46423c8624055fce26205.zip
meson-d2bcb6e06f2c90f7aec46423c8624055fce26205.tar.gz
meson-d2bcb6e06f2c90f7aec46423c8624055fce26205.tar.bz2
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.
-rwxr-xr-xrun_meson_command_tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/run_meson_command_tests.py b/run_meson_command_tests.py
index a6a137b..e044af5 100755
--- a/run_meson_command_tests.py
+++ b/run_meson_command_tests.py
@@ -132,13 +132,17 @@ class CommandTests(unittest.TestCase):
bindir = (self.tmpdir / 'bin')
bindir.mkdir()
(bindir / 'meson').symlink_to(self.src_root / 'meson.py')
+ (bindir / 'python3').symlink_to(python_command[0])
os.environ['PATH'] = str(bindir) + os.pathsep + os.environ['PATH']
+ # use our overridden PATH-compatible python
+ path_resolved_meson_command = resolved_meson_command.copy()
+ path_resolved_meson_command[0] = str(bindir / 'python3')
# See if it works!
meson_py = 'meson'
meson_setup = [meson_py, 'setup']
meson_command = meson_setup + self.meson_args
stdo = self._run(meson_command + [self.testdir, builddir])
- self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
+ self.assertMesonCommandIs(stdo.split('\n')[0], path_resolved_meson_command)
def test_meson_installed(self):
# Install meson