Skip to content

Commit b2fe7ab

Browse files
committed
runtests: fixes
1 parent 6012115 commit b2fe7ab

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

runtests.sh

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@ fi
2020
# default to most recent version
2121
prunepytest=${PRUNEPYTEST_INSTALL:-prunepytest}
2222

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+
2330
# TODO: sort input folders for predictable ordering
24-
for repo in repos/${1:-*} ; do
31+
for repo in "${repos[@]}" ; do
2532
echo "--- validating: $repo"
2633

2734
# use subshell to avoid cross-contamination
@@ -30,7 +37,9 @@ for repo in repos/${1:-*} ; do
3037
cd "$repo"
3138
d=".repo"
3239

33-
if [[ "${DIRTY:-}" != "1" ]] ; then
40+
if [[ "${DIRTY:-}" == "1" ]] && [[ -d "$d/.venv" ]]; then
41+
cd "$d"
42+
else
3443
clone_args=($(cat repo_url))
3544

3645
# quick repo clone
@@ -45,8 +54,6 @@ for repo in repos/${1:-*} ; do
4554
else
4655
uv venv .venv --seed
4756
fi
48-
else
49-
cd "$d"
5057
fi
5158

5259
source .venv/bin/activate
@@ -60,11 +67,9 @@ for repo in repos/${1:-*} ; do
6067
exit
6168
fi
6269

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
6873
fi
6974

7075
# ensure we have prunepytest installed
@@ -83,21 +88,35 @@ for repo in repos/${1:-*} ; do
8388
runpy=(${python} -m)
8489
fi
8590

86-
# save graph in pre-test validation for use at test-time
87-
prune_args=(--prune-graph graph.bin)
91+
prune_args=()
8892
if [ -f "../hook.py" ] ; then
8993
prune_args+=(--prune-hook ../hook.py)
9094
fi
9195

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)
9499

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
97115
fi
98116

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[@]}"})
101120
export PYTEST_ADDOPTS="${pytest_args[@]}"
102121
if [ -x ../runtests.sh ] ; then
103122
../runtests.sh

0 commit comments

Comments
 (0)