aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-06-04 14:03:56 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-06-07 16:40:52 -0400
commitdf053848ebbd0af2f0b4722aa88e5278d8321474 (patch)
treef7bd897bb9fcc919981adc249cf890578f289dae /unittests
parent7126ca6e2725c127e788544c5abe6593c20200a5 (diff)
downloadmeson-df053848ebbd0af2f0b4722aa88e5278d8321474.zip
meson-df053848ebbd0af2f0b4722aa88e5278d8321474.tar.gz
meson-df053848ebbd0af2f0b4722aa88e5278d8321474.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".
Diffstat (limited to 'unittests')
-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()