blob: 09a20fbe15f20a00bb7cfe8ea3dcb8189af3b28c [file] [log] [blame]
Junji Watanabe79d1c7c2019-10-21 04:46:49 +00001#!/usr/bin/env vpython
2# Copyright 2019 The LUCI Authors. All rights reserved.
3# Use of this source code is governed under the Apache License, Version 2.0
4# that can be found in the LICENSE file.
5
6import os
7import sys
8
9import six
10
Junji Watanabe79d1c7c2019-10-21 04:46:49 +000011THIS_DIR = os.path.dirname(os.path.abspath(__file__))
12TESTS_DIR = os.path.join(THIS_DIR, 'tests')
Junji Watanabef1cb0a92019-10-25 09:39:38 +000013LUCI_DIR = os.path.dirname(THIS_DIR)
14COMPONENTS_DIR = os.path.join(LUCI_DIR, 'appengine', 'components')
Junji Watanabe79d1c7c2019-10-21 04:46:49 +000015
16def main():
17 sys.path.insert(0, TESTS_DIR)
18 import test_env
19 test_env.setup()
20
Junji Watanabef1cb0a92019-10-25 09:39:38 +000021 sys.path.insert(0, COMPONENTS_DIR)
22 from test_support import parallel_test_runner
23
Junji Watanabe79d1c7c2019-10-21 04:46:49 +000024 # Need to specify config path explicitly
25 # because test_env.setup() changes directory
Junji Watanabef1cb0a92019-10-25 09:39:38 +000026 cfg = os.path.join(COMPONENTS_DIR, 'test_support', 'unittest.cfg')
Junji Watanabe79d1c7c2019-10-21 04:46:49 +000027 sys.argv.extend(['-c', cfg])
28
Junji Watanabe4b168e32019-11-28 14:38:28 +000029 # enable plugins only on linux
30 plugins = []
31 if sys.platform.startswith('linux'):
32 plugins.append('nose2.plugins.mp')
33
Junji Watanabe79d1c7c2019-10-21 04:46:49 +000034 # execute test runner
Junji Watanabe4b168e32019-11-28 14:38:28 +000035 return parallel_test_runner.run_tests(python3=six.PY3, plugins=plugins)
Junji Watanabe79d1c7c2019-10-21 04:46:49 +000036
37
38if __name__ == '__main__':
39 main()