diff options
Diffstat (limited to 'unittests/pythontests.py')
| -rw-r--r-- | unittests/pythontests.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/unittests/pythontests.py b/unittests/pythontests.py index 6f3f07506..4b0581d4a 100644 --- a/unittests/pythontests.py +++ b/unittests/pythontests.py @@ -20,8 +20,9 @@ from run_tests import ( from .allplatformstests import git_init from .baseplatformtests import BasePlatformTests +from .helpers import * -from mesonbuild.mesonlib import TemporaryDirectoryWinProof +from mesonbuild.mesonlib import MachineChoice, TemporaryDirectoryWinProof class PythonTests(BasePlatformTests): ''' @@ -61,6 +62,9 @@ python = pymod.find_installation('python3', required: true) def _test_bytecompile(self, py2=False): testdir = os.path.join(self.src_root, 'test cases', 'python', '2 extmodule') + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = detect_c_compiler(env, MachineChoice.HOST) + self.init(testdir, extra_args=['-Dpython2=auto', '-Dpython.bytecompile=1']) self.build() self.install() @@ -71,7 +75,11 @@ 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')) - self.assertEqual(len(cached), 2) + if 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: @@ -79,6 +87,7 @@ python = pymod.find_installation('python3', required: true) else: self.assertEqual(count, 5) + @xfail_if_jobname('msys2-clangx64ninja') def test_bytecompile_multi(self): if not shutil.which('python2'): raise self.skipTest('python2 not installed') |
