| # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """Wrapper to run all tests with default settings.""" |
| from __future__ import print_function |
| CHROMITE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| SCRIPTS_DIR = os.path.join(CHROMITE_DIR, 'scripts') |
| LEGACY_TEST_RUNNER = os.path.join(SCRIPTS_DIR, 'run_tests') |
| PYTEST_RUNNER = os.path.join(SCRIPTS_DIR, 'run_pytest') |
| 'ERROR: This script takes no arguments. If you want to pass arguments\n' |
| 'to the test suite, try running `scripts/run_tests` or `run_pytest`.', |
| py2_tests_result = run_legacy_tests() |
| py3_tests_result = run_pytest() |
| return py2_tests_result or py3_tests_result |
| print('Running legacy Python 2 tests:') |
| res = subprocess.run([LEGACY_TEST_RUNNER, '--py2']) |
| print('Running pytest under Python 3:') |
| res = subprocess.run([PYTEST_RUNNER]) |
| if __name__ == '__main__': |
| sys.exit(main(sys.argv[1:])) |