Skip to content

Commit 05aaad2

Browse files
committed
Take a swing at adding exclusion checks
1 parent aca93f2 commit 05aaad2

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/reusable-test-lazy-imports-all.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ name: Reusable Lazy Imports Tests
66
# Modules that are known to fail under lazy imports are listed in
77
# Lib/test/lazy_imports_all_exclude.txt and skipped here. Remove entries from
88
# that file as the modules are fixed so this workflow starts guarding them
9-
# against regressions.
9+
# against regressions. Excluded modules are also checked separately so the
10+
# workflow fails when one starts passing and its exclusion should be removed.
1011

1112
on:
1213
workflow_call:
@@ -61,3 +62,20 @@ jobs:
6162
echo "Excluding $(wc -l < exclude_tests.txt) module(s); running $(wc -l < run_tests.txt) of $(wc -l < all_tests.txt)."
6263
- name: Run stdlib tests with lazy imports
6364
run: xvfb-run xargs ./python -m test --fast-ci --timeout=900 < run_tests.txt
65+
- name: Verify excluded tests still need exclusion
66+
if: success()
67+
run: |
68+
set -euo pipefail
69+
unexpected_passes=()
70+
while IFS= read -r test_name; do
71+
[ -n "$test_name" ] || continue
72+
echo "Checking excluded test: $test_name"
73+
if xvfb-run ./python -m test --fast-ci --timeout=900 "$test_name"; then
74+
unexpected_passes+=("$test_name")
75+
fi
76+
done < exclude_tests.txt
77+
if [ "${#unexpected_passes[@]}" -ne 0 ]; then
78+
echo "::error::These tests still appear in $EXCLUDE_FILE but now pass with PYTHON_LAZY_IMPORTS=all. Remove them from the exclude file:"
79+
printf '%s\n' "${unexpected_passes[@]}"
80+
exit 1
81+
fi

Lib/test/lazy_imports_all_exclude.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# here. Exclusion is whole-module: a listed module is skipped entirely, so any
77
# passing tests it contains are not covered until its line is removed. As each
88
# module is fixed, delete its line so the workflow starts guarding it against
9-
# regressions.
9+
# regressions. The workflow also checks listed modules separately and fails if
10+
# one now passes, so accidental fixes prompt cleanup of this file.
1011
#
1112
# Format: one test name per line, exactly as printed by
1213
# ``python -m test --list-tests``. Lines starting with ``#`` and blank lines

0 commit comments

Comments
 (0)