Skip to content

Commit a23ebaf

Browse files
committed
Fix bug with env var not flowing through and bring back exclusions
1 parent c6d590e commit a23ebaf

5 files changed

Lines changed: 1045 additions & 15 deletions

File tree

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Reusable Lazy Imports Tests
22

33
# Run the CPython test suite with global lazy imports forced on
4-
# (``PYTHON_LAZY_IMPORTS=all``, equivalent to ``-X lazy_imports=all``).
4+
# (``-X lazy_imports=all``).
55
#
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
@@ -24,7 +24,6 @@ jobs:
2424
runs-on: ubuntu-24.04
2525
timeout-minutes: 60
2626
env:
27-
PYTHON_LAZY_IMPORTS: all
2827
EXCLUDE_FILE: Lib/test/lazy_imports_all_exclude.txt
2928
steps:
3029
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -41,7 +40,7 @@ jobs:
4140
- name: Display build info
4241
run: make pythoninfo
4342
- name: Verify lazy imports are fully enabled
44-
run: ./python -c "import sys; assert sys.flags.lazy_imports == 1, sys.flags.lazy_imports; print('lazy imports all enabled')"
43+
run: ./python -X lazy_imports=all -c "import sys; assert sys.flags.lazy_imports == 1, sys.flags.lazy_imports; print('lazy imports all enabled')"
4544
- name: Build test list (all tests minus the known-failing exclusions)
4645
run: |
4746
set -euo pipefail
@@ -60,8 +59,8 @@ jobs:
6059
exit 1
6160
fi
6261
echo "Excluding $(wc -l < exclude_tests.txt) module(s); running $(wc -l < run_tests.txt) of $(wc -l < all_tests.txt)."
63-
- name: Run stdlib tests with lazy imports
64-
run: xvfb-run xargs ./python -m test --fast-ci --timeout=900 < run_tests.txt
62+
- name: Run tests with lazy imports
63+
run: xvfb-run xargs ./python -X lazy_imports=all -m test --fast-ci --timeout=900 < run_tests.txt
6564
- name: Verify excluded tests still need exclusion
6665
if: success()
6766
run: |
@@ -70,12 +69,12 @@ jobs:
7069
while IFS= read -r test_name; do
7170
[ -n "$test_name" ] || continue
7271
echo "Checking excluded test: $test_name"
73-
if xvfb-run ./python -m test --fast-ci --timeout=900 "$test_name"; then
72+
if xvfb-run ./python -X lazy_imports=all -m test --fast-ci --timeout=900 "$test_name"; then
7473
unexpected_passes+=("$test_name")
7574
fi
7675
done < exclude_tests.txt
7776
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:"
77+
echo "::error::These tests still appear in $EXCLUDE_FILE but now pass with -X lazy_imports=all. Remove them from the exclude file:"
7978
printf '%s\n' "${unexpected_passes[@]}"
8079
exit 1
8180
fi
Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
11
# Test modules that currently FAIL under global lazy imports
22
# (``-X lazy_imports=all`` / ``PYTHON_LAZY_IMPORTS=all``).
33
#
4-
# The "Lazy Imports All" CI workflow (.github/workflows/lazy-imports-all.yml) runs the
5-
# whole test suite with lazy_imports=all, skipping every module listed
6-
# here. Exclusion is whole-module: a listed module is skipped entirely, so any
7-
# passing tests it contains are not covered until its line is removed. As each
8-
# module is fixed, delete its line so the workflow starts guarding it against
9-
# regressions. The workflow also checks listed modules separately and fails if
10-
# one now passes, so accidental fixes prompt cleanup of this file.
4+
# The "Lazy Imports All" CI workflow
5+
# (.github/workflows/reusable-test-lazy-imports-all.yml) runs the whole test
6+
# suite with lazy_imports=all, skipping every module listed here. Exclusion is
7+
# whole-module: a listed module is skipped entirely, so any passing tests it
8+
# contains are not covered until its line is removed. As each module is fixed,
9+
# delete its line so the workflow starts guarding it against regressions. The
10+
# workflow also checks listed modules separately and fails if one now passes,
11+
# so accidental fixes prompt cleanup of this file.
1112
#
1213
# Format: one test name per line, exactly as printed by
1314
# ``python -m test --list-tests``. Lines starting with ``#`` and blank lines
1415
# are ignored. Note that split test packages use a dotted path
1516
# (e.g. test.test_future_stmt.test_future) while ordinary modules use the bare
1617
# name (e.g. test_builtin).
1718

18-
19+
test.test_inspect.test_inspect
1920
test.test_pydoc.test_pydoc
21+
test___all__
22+
test__interpreters
23+
test_builtin
24+
test_clinic
2025
test_compileall
26+
test_crossinterp
27+
test_datetime
28+
test_external_inspection
29+
test_generated_cases
30+
test_idle
31+
test_import
32+
test_importlib
2133
test_interpreters
34+
test_json
2235
test_lazy_import
36+
test_subprocess
37+
test_symtable
38+
test_tools
39+
test_trace
40+
test_typing
41+
test_unittest
42+
test_xmlrpc
43+
test_zipfile

0 commit comments

Comments
 (0)