20
20
# default to most recent version
21
21
prunepytest=${PRUNEPYTEST_INSTALL:- prunepytest}
22
22
23
+ if [[ -n " ${1:- } " ]] ; then
24
+ repos=(repos/${1} )
25
+ else
26
+ # default omits pandas because its test suite is slow and unreliable
27
+ repos=(repos/mypy repos/pydantic repos/pydantic.v1 repos/tomli)
28
+ fi
29
+
23
30
# TODO: sort input folders for predictable ordering
24
- for repo in repos/ ${1 :-* } ; do
31
+ for repo in " ${repos[@]} " ; do
25
32
echo " --- validating: $repo "
26
33
27
34
# use subshell to avoid cross-contamination
@@ -30,7 +37,9 @@ for repo in repos/${1:-*} ; do
30
37
cd " $repo "
31
38
d=" .repo"
32
39
33
- if [[ " ${DIRTY:- } " != " 1" ]] ; then
40
+ if [[ " ${DIRTY:- } " == " 1" ]] && [[ -d " $d /.venv" ]]; then
41
+ cd " $d "
42
+ else
34
43
clone_args=($( cat repo_url) )
35
44
36
45
# quick repo clone
@@ -45,8 +54,6 @@ for repo in repos/${1:-*} ; do
45
54
else
46
55
uv venv .venv --seed
47
56
fi
48
- else
49
- cd " $d "
50
57
fi
51
58
52
59
source .venv/bin/activate
@@ -60,11 +67,9 @@ for repo in repos/${1:-*} ; do
60
67
exit
61
68
fi
62
69
63
- if [[ " ${DIRTY:- } " != " 1" ]] ; then
64
- # NB: for some packages, this might recreate the venv...
65
- if [ -x ../setup.sh ] ; then
66
- ../setup.sh
67
- fi
70
+ # NB: for some packages, this might recreate the venv...
71
+ if [ -x ../setup.sh ] ; then
72
+ ../setup.sh
68
73
fi
69
74
70
75
# ensure we have prunepytest installed
@@ -83,21 +88,35 @@ for repo in repos/${1:-*} ; do
83
88
runpy=(${python} -m)
84
89
fi
85
90
86
- # save graph in pre-test validation for use at test-time
87
- prune_args=(--prune-graph graph.bin)
91
+ prune_args=()
88
92
if [ -f " ../hook.py" ] ; then
89
93
prune_args+=(--prune-hook ../hook.py)
90
94
fi
91
95
92
- echo " pre-test validation"
93
- " ${runpy[@]} " prunepytest.validator " ${prune_args[@]} "
96
+ if [[ " ${VALIDATE:- 1} " == " 1" ]] ; then
97
+ # save graph in pre-test validation for use at test-time
98
+ prune_args+=(--prune-graph graph.bin)
94
99
95
- if [[ " ${PY_COVERAGE:- } " == " 1" ]] ; then
96
- mv cov.json cov.pretest.json
100
+ echo " pre-test validation"
101
+ " ${runpy[@]} " prunepytest.validator " ${prune_args[@]} "
102
+
103
+ if [[ " ${PY_COVERAGE:- } " == " 1" ]] ; then
104
+ mv cov.json cov.pretest.json
105
+ fi
106
+
107
+ echo " test-time validation"
108
+ pytest_args=(--prune --prune-no-select " ${prune_args[@]} " )
109
+ export PYTEST_ADDOPTS=" ${pytest_args[@]} "
110
+ if [ -x ../runtests.sh ] ; then
111
+ ../runtests.sh
112
+ else
113
+ " ${runpy[@]} " pytest
114
+ fi
97
115
fi
98
116
99
- echo " test-time validation"
100
- pytest_args=(--prune --prune-no-select " ${prune_args[@]} " )
117
+ echo " impact check"
118
+ impact_depth=${IMPACT_DEPTH:- 20}
119
+ pytest_args=(--prune --prune-impact --prune-impact-depth " ${impact_depth} " ${prune_args: +" ${prune_args[@]} " } )
101
120
export PYTEST_ADDOPTS=" ${pytest_args[@]} "
102
121
if [ -x ../runtests.sh ] ; then
103
122
../runtests.sh
0 commit comments