-
Notifications
You must be signed in to change notification settings - Fork 419
/
pytest
executable file
·41 lines (34 loc) · 1.12 KB
/
pytest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
"""": # -*-python-*-
set -eu
# Changes here might also be appropriate for ./pylint
script_home="$(cd "$(dirname "$0")" && pwd -P)"
testlibdir="$script_home/test/lib"
export PYTHONPATH="$testlibdir${PYTHONPATH: :$PYTHONPATH}"
exec dev/bup-python "$0" ${1 "$@"}
"""
import pytest, shlex, sys
argv = ['-v', '-m', 'not release']
## Drop all xdist related opts if xdist isn't available. Otherwise
## default to worksteal if the version's new enough since it claims,
## and appears, to handle test sets with more widely varying run times
## better.
try:
import xdist
xdist_ver = xdist.__version__.split('.')
if xdist_ver >= ['3', '2', '1']: # #884: Fixed hang in worksteal scheduler
argv.extend(('--dist', 'worksteal'))
argv.extend(sys.argv[1:])
except ModuleNotFoundError: # delete all -n opts
i = 1
while i < len(sys.argv):
arg = sys.argv[i]
if arg == '-n':
i = 2
elif arg.startswith('-n'):
i = 1
else:
argv.append(sys.argv[i])
i = 1
print(shlex.join(['pytest'] argv), file=sys.stderr)
sys.exit(pytest.main(args=argv))