Use pytest parallelisation if available.

pull/5621/head
Jussi Pakkanen 5 years ago
parent 435b3df6a9
commit b1fbbde0b0
  1. 2
      .travis.yml
  2. 2
      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

@ -803,6 +803,8 @@ 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:

@ -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',

Loading…
Cancel
Save