Use pytest parallelisation if available.

Backported to 0.51.2
pull/5842/head
Jussi Pakkanen 5 years ago committed by Nirbheek Chauhan
parent 5b02f88bf6
commit be16f4cf0a
  1. 2
      .travis.yml
  2. 4
      run_project_tests.py
  3. 13
      run_unittests.py

@ -63,4 +63,4 @@ script:
/bin/sh -c "cd /root && mkdir -p tools; wget -c http://nirbheek.in/files/binaries/ninja/linux-amd64/ninja -O /root/tools/ninja; chmod +x /root/tools/ninja; CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX PATH=/root/tools:$PATH MESON_FIXED_NINJA=1 ./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS && chmod -R a+rwX .coverage"
fi
# Ensure that llvm is added after $PATH, otherwise the clang from that llvm install will be used instead of the native apple clang.
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib OBJC=$CC OBJCXX=$CXX PATH=$HOME/tools:/usr/local/opt/qt/bin:$PATH:$(brew --prefix llvm)/bin MESON_FIXED_NINJA=1 ./run_tests.py --backend=ninja -- $MESON_ARGS ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib OBJC=$CC OBJCXX=$CXX PATH=$HOME/tools:/usr/local/opt/qt/bin:$PATH:$(brew --prefix llvm)/bin MESON_FIXED_NINJA=1 ./run_tests.py $RUN_TESTS_ARGS --backend=ninja -- $MESON_ARGS ; fi

@ -790,6 +790,10 @@ def check_format():
for (root, _, files) in os.walk('.'):
if '.dub' in root: # external deps are here
continue
if '.pytest_cache' in root:
continue
if 'meson-logs' in root or 'meson-private' in root:
continue
for fname in files:
if os.path.splitext(fname)[1].lower() in check_suffixes:
bn = os.path.basename(fname)

@ -3350,7 +3350,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')
@ -6413,6 +6413,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',

Loading…
Cancel
Save