aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-07-08 21:21:17 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-07-09 22:38:30 +0300
commitb1fbbde0b097496b5113b50124b31f56fd4f76bb (patch)
treef6814f067ac776b128403bcbc2d754b0bba9f95d /run_unittests.py
parent435b3df6a91bbd43c30b3460c72f77dec29d0137 (diff)
downloadmeson-b1fbbde0b097496b5113b50124b31f56fd4f76bb.zip
meson-b1fbbde0b097496b5113b50124b31f56fd4f76bb.tar.gz
meson-b1fbbde0b097496b5113b50124b31f56fd4f76bb.tar.bz2
Use pytest parallelisation if available.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py
index d9281cf..33174b1 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -3398,7 +3398,7 @@ recommended as it is not supported on some platforms''')
for entry in res:
name = entry['name']
- self.assertEquals(entry['subproject'], expected[name])
+ self.assertEqual(entry['subproject'], expected[name])
def test_introspect_projectinfo_subproject_dir(self):
testdir = os.path.join(self.common_test_dir, '79 custom subproject dir')
@@ -6480,6 +6480,17 @@ def unset_envs():
def main():
unset_envs()
+ pytest_args = ['-n', 'auto', './run_unittests.py']
+ if shutil.which('pytest-3'):
+ return subprocess.run(['pytest-3'] + pytest_args).returncode
+ elif shutil.which('pytest'):
+ return subprocess.run(['pytest'] + pytest_args).returncode
+ try:
+ import pytest # noqa: F401
+ return subprocess.run(python_command + ['-m', 'pytest'] + pytest_args).returncode
+ except ImportError:
+ pass
+ # All attempts at locating pytest failed, fall back to plain unittest.
cases = ['InternalTests', 'DataTests', 'AllPlatformTests', 'FailureTests',
'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests',
'TAPParserTests',