aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-06-04 14:03:56 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-06-06 22:07:16 -0400
commit572f7a4280c6bc2b1690bcff8da6bae6b0d4cc82 (patch)
tree2da2a79618f084d31cf19a3d67a299ce3ae8a235
parentae42c67da5f5f494aefe649cb0c343a1dc008780 (diff)
downloadmeson-572f7a4280c6bc2b1690bcff8da6bae6b0d4cc82.zip
meson-572f7a4280c6bc2b1690bcff8da6bae6b0d4cc82.tar.gz
meson-572f7a4280c6bc2b1690bcff8da6bae6b0d4cc82.tar.bz2
unittests: fix incorrect calculation of bytecompile outputs
If py2 is not found *and* the compiler is MSVC, we didn't take into account that py2 is not found. This also meant that we didn't take into account the expected count when it *is* found, because the python module has a better finder than just "is the binary on PATH".
-rw-r--r--unittests/pythontests.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/unittests/pythontests.py b/unittests/pythontests.py
index 4b0581d..b8c19b2 100644
--- a/unittests/pythontests.py
+++ b/unittests/pythontests.py
@@ -23,6 +23,7 @@ from .baseplatformtests import BasePlatformTests
from .helpers import *
from mesonbuild.mesonlib import MachineChoice, TemporaryDirectoryWinProof
+from mesonbuild.modules.python import PythonModule
class PythonTests(BasePlatformTests):
'''
@@ -75,25 +76,25 @@ python = pymod.find_installation('python3', required: true)
realfile = os.path.join(root, file)
if file.endswith('.py'):
cached = glob.glob(realfile+'?') + glob.glob(os.path.join(root, '__pycache__', os.path.splitext(file)[0] + '*.pyc'))
- if cc.get_id() == 'msvc':
+ if py2 and cc.get_id() == 'msvc':
# MSVC python installs python2/python3 into the same directory
self.assertLength(cached, 4)
else:
self.assertLength(cached, 2)
count += 1
# there are 5 files x 2 installations
- if py2:
+ if py2 and not cc.get_id() == 'msvc':
self.assertEqual(count, 10)
else:
self.assertEqual(count, 5)
@xfail_if_jobname('msys2-clangx64ninja')
def test_bytecompile_multi(self):
- if not shutil.which('python2'):
+ if not shutil.which('python2') and not PythonModule._get_win_pythonpath('python2'):
raise self.skipTest('python2 not installed')
self._test_bytecompile(True)
def test_bytecompile_single(self):
- if shutil.which('python2'):
+ if shutil.which('python2') or PythonModule._get_win_pythonpath('python2'):
raise self.skipTest('python2 installed, already tested')
self._test_bytecompile()