if not running_single_tests(sys.argv, cases): pytest_args += ['-n', 'auto'] # Let there be colors! if 'CI' in os.environ: pytest_args += ['--color=yes'] pytest_args += ['./run_unittests.py'] pytest_args += convert_args(sys.argv[1:]) # Always disable pytest-cov because we use a custom setup try: import pytest_cov # noqa: F401 print('Disabling pytest-cov') pytest_args += ['-p' 'no:cov'] except ImportError: pass return subprocess.run(python_command + ['-m', 'pytest'] + pytest_args).returncode except ImportError: print('pytest-xdist not found, using unittest instead') # Fallback to plain unittest. return unittest.main(defaultTest=cases, buffer=True) if __name__ == '__main__': setup_vsenv() print('Meson build system', mesonbuild.coredata.version, 'Unit Tests') start = time.monotonic() try: raise SystemExit(main()) finally: print('Total time: {:.3f} seconds'.format(time.monotonic() - start))
else: print(mlog.bold('Running unittests.')) print(flush=True) cmd = mesonlib.python_command + ['run_unittests.py', '--backend=' + backend.name, '-v'] if options.failfast: cmd += ['--failfast'] returncode += subprocess.call(cmd, env=env) if options.failfast and returncode != 0: return returncode cmd = mesonlib.python_command + ['run_project_tests.py'] + sys.argv[1:] returncode += subprocess.call(cmd, env=env) else: cross_test_args = mesonlib.python_command + ['run_cross_test.py'] for cf in options.cross: print(mlog.bold(f'Running {cf} cross tests.')) print(flush=True) cmd = cross_test_args + ['cross/' + cf] if options.failfast: cmd += ['--failfast'] if options.cross_only: cmd += ['--cross-only'] returncode += subprocess.call(cmd, env=env) if options.failfast and returncode != 0: return returncode return returncode if __name__ == '__main__': mesonmain.setup_vsenv() print('Meson build system', meson_version, 'Project and Unit Tests') raise SystemExit(main())