summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrun_tests42
-rw-r--r--run_tests.vpython361
2 files changed, 63 insertions, 40 deletions
diff --git a/run_tests b/run_tests
index 5de51cf0..0ea098a6 100755
--- a/run_tests
+++ b/run_tests
@@ -15,46 +15,8 @@
15 15
16"""Wrapper to run pytest with the right settings.""" 16"""Wrapper to run pytest with the right settings."""
17 17
18import os
19import shutil
20import subprocess
21import sys 18import sys
22 19import pytest
23
24def find_pytest():
25 """Try to locate a good version of pytest."""
26 # If we're in a virtualenv, assume that it's provided the right pytest.
27 if 'VIRTUAL_ENV' in os.environ:
28 return 'pytest'
29
30 # Use the Python 3 version if available.
31 ret = shutil.which('pytest-3')
32 if ret:
33 return ret
34
35 # Hopefully this is a Python 3 version.
36 ret = shutil.which('pytest')
37 if ret:
38 return ret
39
40 print('%s: unable to find pytest.' % (__file__,), file=sys.stderr)
41 print('%s: Try installing: sudo apt-get install python-pytest' % (__file__,),
42 file=sys.stderr)
43
44
45def main(argv):
46 """The main entry."""
47 # Add the repo tree to PYTHONPATH as the tests expect to be able to import
48 # modules directly.
49 pythonpath = os.path.dirname(os.path.realpath(__file__))
50 oldpythonpath = os.environ.get('PYTHONPATH', None)
51 if oldpythonpath is not None:
52 pythonpath += os.pathsep + oldpythonpath
53 os.environ['PYTHONPATH'] = pythonpath
54
55 pytest = find_pytest()
56 return subprocess.run([pytest] + argv, check=False).returncode
57
58 20
59if __name__ == '__main__': 21if __name__ == '__main__':
60 sys.exit(main(sys.argv[1:])) 22 sys.exit(pytest.main(sys.argv[1:]))
diff --git a/run_tests.vpython3 b/run_tests.vpython3
new file mode 100644
index 00000000..d0e821dd
--- /dev/null
+++ b/run_tests.vpython3
@@ -0,0 +1,61 @@
1# This is a vpython "spec" file.
2#
3# Read more about `vpython` and how to modify this file here:
4# https://chromium.googlesource.com/infra/infra/+/main/doc/users/vpython.md
5# List of available wheels:
6# https://chromium.googlesource.com/infra/infra/+/main/infra/tools/dockerbuild/wheels.md
7
8python_version: "3.8"
9
10wheel: <
11 name: "infra/python/wheels/pytest-py3"
12 version: "version:6.2.2"
13>
14
15# Required by pytest==6.2.2
16wheel: <
17 name: "infra/python/wheels/py-py2_py3"
18 version: "version:1.10.0"
19>
20
21# Required by pytest==6.2.2
22wheel: <
23 name: "infra/python/wheels/iniconfig-py3"
24 version: "version:1.1.1"
25>
26
27# Required by pytest==6.2.2
28wheel: <
29 name: "infra/python/wheels/packaging-py2_py3"
30 version: "version:16.8"
31>
32
33# Required by pytest==6.2.2
34wheel: <
35 name: "infra/python/wheels/pluggy-py3"
36 version: "version:0.13.1"
37>
38
39# Required by pytest==6.2.2
40wheel: <
41 name: "infra/python/wheels/toml-py3"
42 version: "version:0.10.1"
43>
44
45# Required by pytest==6.2.2
46wheel: <
47 name: "infra/python/wheels/pyparsing-py3"
48 version: "version:3.0.7"
49>
50
51# Required by pytest==6.2.2
52wheel: <
53 name: "infra/python/wheels/attrs-py2_py3"
54 version: "version:21.4.0"
55>
56
57# Required by packaging==16.8
58wheel: <
59 name: "infra/python/wheels/six-py2_py3"
60 version: "version:1.16.0"
61>