Update `test/libregrtest` to CPython 3.13.10 by fanninpm · Pull Request #6410 · RustPython/RustPython
Repository navigation
Update test/libregrtest to CPython 3.13.10 - #6410
Merged
youknowone merged 53 commits into RustPython:main from fanninpm:update-libregrtest Jan 11, 2026
Merged
Update test/libregrtest to CPython 3.13.10 #6410
youknowone merged 53 commits into
RustPython:main from
fanninpm:update-libregrtest
Conversation
fanninpm
commented
Dec 12, 2025
·
edited by coderabbitai
Bot
Loading
Copy link Copy Markdown
Contributor
-
Update test/libregrtest to CPython 3.13.10
-
Re-add try block around platform and encodings info
-
Disable
WindowsLoadTrackeron Windows -
Disable
struct._clearcache() -
Disable
saved_test_environmentcontext manager -
Disable
support.record_original_stdout() -
faulthandler.dump_traceback_later() -
inspect._shadowed_dict_from_weakref_mro_tuple()Update dataclasses, inspect from CPython 3.13 #5377
Summary by CodeRabbit
- Chores
- Improved CI to detect and verify post-test environment pollution with repeated, OS-specific checks (Linux/macOS/Windows).
- Added environment-variable toggles to enable or skip pollution verification for relevant jobs.
- Introduced retry loops (up to 10 attempts), per-test and overall timeouts, and clearer guidance when pollution persists.
- Normalized CI command formatting and updated minor consistency/formatting details for stability.
✏️ Tip: You can customize this high-level summary in your review settings.
coderabbitai
Bot
commented
Dec 12, 2025
·
edited
Loading
Copy link Copy Markdown
Contributor
📝 Walkthrough
WalkthroughCI workflow enhanced to detect and mitigate environment‑polluting tests by adding per‑OS polluter groups, setting skip flags for standard runs, and introducing per‑OS verification loops that retry suspect polluter tests up to 10 times and fail with remediation guidance if pollution persists. (33 words) Changes
Sequence Diagram(s)sequenceDiagram
participant GH as GitHub Actions
participant Runner as Job Runner
participant Test as Test Executor
participant Verifier as Pollution Verifier
GH->>Runner: start job (env includes ENV_POLLUTING_* groups)
Runner->>Test: run tests (env: RUSTPYTHON_SKIP_ENV_POLLUTERS=true, per-test timeout)
Test-->>Runner: exit code (0 / 1 / 3)
note right of Runner: exit code 3 = polluter detected
alt polluter detected (exit 3)
Runner->>Verifier: run ENV_POLLUTING_COMMON + ENV_POLLUTING_OS tests (retry up to 10, 15min overall)
loop up to 10 attempts
Verifier->>Test: run specific polluter test (600s timeout)
Test-->>Verifier: exit code (0 / 1 / 3)
alt exit code 3
Verifier-->Verifier: still polluting → retry
else
Verifier-->Runner: polluter cleared for that test
end
end
alt any still polluting after retries
Verifier-->>GH: fail job and print remediation guidance
else
Verifier-->>GH: continue pipeline
end
end
Loading
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem🚥 Pre-merge checks | ✅ 2 | ❌ 1 ❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit ! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment |
a5a599f to
2a0a591
Compare
December 12, 2025 13:48 This was referenced Dec 12, 2025 Update
test_generators.py from 3.13.11
#6426
Merged
Update test_setcomps.py from 3.13.11
#6425
Merged
Update test_raise.py from 3.13.11
#6423
Merged
Update test_xmlrpc.py from 3.13.11
#6430
Merged
youknowone
force-pushed
the
update-libregrtest
branch
from
2a0a591 to
80ddfb6
Compare
December 13, 2025 07:52 This was referenced Dec 13, 2025 Update
test_urllibnet.py from 3.13.11
#6432
Merged
Update test_zipfile64.py from 3.13.11
#6433
Merged
Update test_urllib2net.py from 3.13.11
#6434
Merged
Update test_smtpnet.py from 3.13.11
#6435
Merged
fanninpm
mentioned this pull request
Dec 16, 2025
Skip flakey test
#6453
Merged
fanninpm
force-pushed
the
update-libregrtest
branch
2 times, most recently
from
d59be8b to
8c74805
Compare
December 24, 2025 02:42 This was referenced Dec 24, 2025 Update
test_http_cookies.py from 3.13.11
#6481
Merged
Update test_threading_local.py from 3.13.11
#6482
Merged
Update shelve.py from 3.13.11
#6483
Merged
youknowone
force-pushed
the
update-libregrtest
branch
from
8c74805 to
bff54a5
Compare
December 30, 2025 17:09 fanninpm force-pushed the update-libregrtest branch from
bff54a5 to
a4cf244
Compare
December 30, 2025 21:38
fanninpm commented Dec 30, 2025 · edited Loading
Copy link Copy Markdown
Contributor
Author
OUTDATED!I will write a new comment detailing the status over the weekend. All platformsTests failing
Tests altering the execution environment when they're not supposed to (might be something that we need to change in
|
e629b6b to
014cb12
Compare
January 1, 2026 16:48
youknowone commented Jan 2, 2026
Copy link Copy Markdown
Member
|
@fanninpm awesome to see this is green. is this done? Do you have idea what affects fail_env_changed ? (though we can fix it later) |
9d7d65a to
4c76eef
Compare
January 3, 2026 02:31
fanninpm commented Jan 3, 2026
Copy link Copy Markdown
Contributor
Author
Not anymore 😕
At the time you wrote your comment, it needed a rebase due to #6506 .
I currently have no idea, other than possibly the "Disable saved_test_environment context manager" and the "Disable support.record_original_stdout()" commits. I'm rewriting the skip logic so that one can detect if a test is no longer polluting the environment. |
b435f6d to
7bf9c34
Compare
January 3, 2026 16:29 fanninpm and others added 15 commits January 10, 2026 22:10
Skip test causing worker bug in test_builtin
98d8ebc
Make env polluter skip in test_threading os-agnostic
d1e75c0
Remove test_file_eintr from list of polluters
55c3096
Remove test_subprocess from the list of polluters
a09ed1b
Address coderabbit comments
e6d2ba0
fix threading._dangling
def6974
Skip environment polluter in test.test_concurrent_futures.test_thread...
ae6deb7
..._pool
Make skip in test_thread_pool os-agnostic
1c07d35
Skip problematic tests in test_wait
1642959
Skip flaky tests in test_process_pool
daaae22
Remove test_import from list of polluters
717265a
Amend skips in test.test_multiprocessing_forkserver.test_processes
80af69e
Remove test_raise from list of polluters
8d505dc
Remove test_ssl from list of polluters
f9a1f2b
Skip flaky test in test_ssl
7445b27
fanninpm
force-pushed
the
update-libregrtest
branch
from
7540fe2 to
7445b27
Compare
January 11, 2026 03:10 fanninpm marked this pull request as ready for review January 11, 2026 03:43 fanninpm requested review from ShaharNaveh and youknowone January 11, 2026 03:44 coderabbitai
Bot
reviewed Jan 11, 2026
View reviewed changes
coderabbitai
Bot
left a comment
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Actionable comments posted: 1
🤖 Fix all issues with AI agentsIn @.github/workflows/ci.yaml:
- Around line 178-181: The "Test example projects" step's multi-line run value
is missing a block scalar indicator causing YAML to join the two cargo commands
into one invalid line; change the step to use a block scalar (e.g., replace the
single-line run with a block scalar like `run: |`) and place each command on its
own line so both `cargo run --manifest-path
example_projects/barebone/Cargo.toml` and `cargo run --manifest-path
example_projects/frozen_stdlib/Cargo.toml` execute separately under the "Test
example projects" step.
🧹 Nitpick comments (1) .github/workflows/ci.yaml (1)📜 Review details
322-404: Consider extracting repeated pollution-check logic to reduce duplication.These three blocks (Linux, macOS, Windows) are nearly identical -- only the OS condition and env var names differ. This ~80 lines of duplication could be consolidated into a reusable composite action or a parameterized shell script that accepts the OS-specific env var as input.
♻️ Example approach: extract to a scriptCreate a script
scripts/check_env_polluters.sh:#!/bin/bash # Usage: check_env_polluters.sh <os_name> <test_list> OS_NAME="$1" shift for thing in "$@"; do for i in $(seq 1 10); do set +e target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v "${thing}" exit_code=$? set -e if [ ${exit_code} -eq 3 ]; then echo "Test ${thing} polluted the environment on attempt ${i}." break fi done if [ ${exit_code} -ne 3 ]; then echo "Test ${thing} is no longer polluting the environment after ${i} attempts!" echo "Please remove ${thing} from ENV_POLLUTING_TESTS in '.github/workflows/ci.yaml'." if [ ${exit_code} -ne 0 ]; then echo "Test ${thing} failed with exit code ${exit_code}." fi exit 1 fi doneThen in the workflow:
- if: runner.os == 'Linux' name: run cpython tests to check if env polluters have stopped polluting run: bash scripts/check_env_polluters.sh Linux ${{ env.ENV_POLLUTING_TESTS_COMMON }} ${{ env.ENV_POLLUTING_TESTS_LINUX }} timeout-minutes: 15
Configuration used : Path: .coderabbit.yml
Review profile : CHILL
Plan : Pro
📥 CommitsReviewing files that changed from the base of the PR and between e181482 and 7445b27 .
⛔ Files ignored due to path filters (46)Lib/test/__main__.pyis excluded by!Lib/**Lib/test/_test_eintr.pyis excluded by!Lib/**Lib/test/autotest.pyis excluded by!Lib/**Lib/test/libregrtest/__init__.pyis excluded by!Lib/**Lib/test/libregrtest/cmdline.pyis excluded by!Lib/**Lib/test/libregrtest/filter.pyis excluded by!Lib/**Lib/test/libregrtest/findtests.pyis excluded by!Lib/**Lib/test/libregrtest/logger.pyis excluded by!Lib/**Lib/test/libregrtest/main.pyis excluded by!Lib/**Lib/test/libregrtest/mypy.iniis excluded by!Lib/**Lib/test/libregrtest/pgo.pyis excluded by!Lib/**Lib/test/libregrtest/refleak.pyis excluded by!Lib/**Lib/test/libregrtest/result.pyis excluded by!Lib/**Lib/test/libregrtest/results.pyis excluded by!Lib/**Lib/test/libregrtest/run_workers.pyis excluded by!Lib/**Lib/test/libregrtest/runtest.pyis excluded by!Lib/**Lib/test/libregrtest/runtest_mp.pyis excluded by!Lib/**Lib/test/libregrtest/runtests.pyis excluded by!Lib/**Lib/test/libregrtest/save_env.pyis excluded by!Lib/**Lib/test/libregrtest/setup.pyis excluded by!Lib/**Lib/test/libregrtest/single.pyis excluded by!Lib/**Lib/test/libregrtest/testresult.pyis excluded by!Lib/**Lib/test/libregrtest/tsan.pyis excluded by!Lib/**Lib/test/libregrtest/utils.pyis excluded by!Lib/**Lib/test/libregrtest/win_utils.pyis excluded by!Lib/**Lib/test/libregrtest/worker.pyis excluded by!Lib/**Lib/test/test_builtin.pyis excluded by!Lib/**Lib/test/test_concurrent_futures/test_process_pool.pyis excluded by!Lib/**Lib/test/test_concurrent_futures/test_thread_pool.pyis excluded by!Lib/**Lib/test/test_concurrent_futures/test_wait.pyis excluded by!Lib/**Lib/test/test_ftplib.pyis excluded by!Lib/**Lib/test/test_importlib/resources/test_resource.pyis excluded by!Lib/**Lib/test/test_io.pyis excluded by!Lib/**Lib/test/test_logging.pyis excluded by!Lib/**Lib/test/test_multiprocessing_fork/test_manager.pyis excluded by!Lib/**Lib/test/test_multiprocessing_fork/test_misc.pyis excluded by!Lib/**Lib/test/test_multiprocessing_fork/test_processes.pyis excluded by!Lib/**Lib/test/test_multiprocessing_fork/test_threads.pyis excluded by!Lib/**Lib/test/test_multiprocessing_forkserver/test_processes.pyis excluded by!Lib/**Lib/test/test_multiprocessing_forkserver/test_threads.pyis excluded by!Lib/**Lib/test/test_multiprocessing_spawn/test_processes.pyis excluded by!Lib/**Lib/test/test_multiprocessing_spawn/test_threads.pyis excluded by!Lib/**Lib/test/test_regrtest.pyis excluded by!Lib/**Lib/test/test_ssl.pyis excluded by!Lib/**Lib/test/test_threading.pyis excluded by!Lib/**Lib/test/test_urllib2net.pyis excluded by!Lib/**
.github/workflows/ci.yaml
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5947
File: .github/workflows/ci.yaml:116-116
Timestamp: 2025-07-11T09:35:43.571Z
Learning: GitHub Actions timeout-minutes field supports expressions that evaluate to integers, such as `${{ contains(matrix.os, 'windows') && 40 || 30 }}`, which will conditionally set different timeout values based on the runner OS.
Applied to files:
.github/workflows/ci.yaml
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T14:03:49.034Z
Learning: Applies to **/*.rs : Always run clippy to lint code (`cargo clippy`) before completing tasks and fix any warnings or lints introduced by changes
Applied to files:
.github/workflows/ci.yaml
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T14:03:49.034Z
Learning: Applies to **/*.rs : Follow the default rustfmt code style by running `cargo fmt` to format Rust code
Applied to files:
.github/workflows/ci.yaml
.github/workflows/ci.yaml (4)
108-125: LGTM - Good separation of OS-specific polluting tests.The structure cleanly separates common polluters from platform-specific ones. Minor note:
ENV_POLLUTING_TESTS_WINDOWSbeing empty with>-followed by a comment works but could be clearer with an explicit empty value comment for future maintainers.
296-319: LGTM - Consistent environment variable usage across platforms.The
RUSTPYTHON_SKIP_ENV_POLLUTERSenvironment variable is applied uniformly to all platform test steps, providing a clean mechanism to skip polluting tests during standard runs.
424-469: LGTM - Formatting normalization.Minor formatting adjustments (indentation and quoting) improve consistency.
481-493: LGTM - Improved comment readability.Breaking the MIRIFLAGS comment across multiple lines improves clarity.
Fix YAML formatting issue
1dcded4
coderabbitai
Bot
reviewed Jan 11, 2026
View reviewed changes
coderabbitai
Bot
left a comment
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Actionable comments posted: 0
🧹 Nitpick comments (2).github/workflows/ci.yaml (2)📜 Review details
351-405: Consider extracting duplicated verification logic (optional).The three verification steps (Linux, macOS, Windows) share nearly identical bash logic, differing only in the platform-specific environment variables. While this duplication is acceptable in CI YAML and keeps each step explicit, you could optionally extract this to a composite action or shell script to reduce maintenance burden.
Example: Extract to a scriptCreate
.github/scripts/verify-polluters.sh:#!/bin/bash # Usage: verify-polluters.sh "test1 test2..." "PLATFORM_NAME" POLLUTERS="$1" PLATFORM="$2" for thing in ${POLLUTERS}; do for i in $(seq 1 10); do set +e target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v ${thing} exit_code=$? set -e if [ ${exit_code} -eq 3 ]; then echo "Test ${thing} polluted the environment on attempt ${i}." break fi done if [ ${exit_code} -ne 3 ]; then echo "Test ${thing} is no longer polluting the environment after ${i} attempts!" echo "Please remove ${thing} from ENV_POLLUTING_TESTS_COMMON or ENV_POLLUTING_TESTS_${PLATFORM} in '.github/workflows/ci.yaml'." echo "Please also remove the skip decorators that include the word 'POLLUTERS' in ${thing}." if [ ${exit_code} -ne 0 ]; then echo "Test ${thing} failed with exit code ${exit_code}." echo "Please investigate which test item in ${thing} is failing and either mark it as an expected failure or a skip." fi exit 1 fi doneThen call it from each step:
run: bash .github/scripts/verify-polluters.sh "${{ env.ENV_POLLUTING_TESTS_COMMON }} ${{ env.ENV_POLLUTING_TESTS_LINUX }}" "LINUX"
323-405: Consider CI time impact of verification steps.The three verification steps add up to 45 minutes of cumulative testing time across platforms. While this overhead is necessary to automatically detect when polluter tests are fixed, consider:
- Current approach (every run) : Ensures prompt detection but adds consistent overhead
- Alternative (scheduled/manual) : Could run verification steps on a schedule (e.g., nightly) or manual trigger to reduce PR CI time
The current approach is valid if prompt detection is prioritized over CI speed. Given the active bisecting work mentioned in the PR description, running on every CI execution makes sense during this phase.
Configuration used : Path: .coderabbit.yml
Review profile : CHILL
Plan : Pro
📥 CommitsReviewing files that changed from the base of the PR and between 7445b27 and 1dcded4 .
📒 Files selected for processing (1).github/workflows/ci.yaml
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5947
File: .github/workflows/ci.yaml:116-116
Timestamp: 2025-07-11T09:35:43.571Z
Learning: GitHub Actions timeout-minutes field supports expressions that evaluate to integers, such as `${{ contains(matrix.os, 'windows') && 40 || 30 }}`, which will conditionally set different timeout values based on the runner OS.
Applied to files:
.github/workflows/ci.yaml
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T14:03:49.034Z
Learning: Applies to **/*.rs : Always run clippy to lint code (`cargo clippy`) before completing tasks and fix any warnings or lints introduced by changes
Applied to files:
.github/workflows/ci.yaml
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-27T14:03:49.034Z
Learning: Applies to **/*.rs : Follow the default rustfmt code style by running `cargo fmt` to format Rust code
Applied to files:
.github/workflows/ci.yaml
- GitHub Check: Run rust tests (macos-latest)
- GitHub Check: Run snippets and cpython tests on wasm-wasi
- GitHub Check: Run rust tests (windows-2025)
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Run snippets and cpython tests (macos-latest)
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Run snippets and cpython tests (windows-2025)
- GitHub Check: Check Rust code with clippy
- GitHub Check: Ensure compilation on various targets
- GitHub Check: Run tests under miri
- GitHub Check: Check the WASM package and demo
.github/workflows/ci.yaml (4)youknowone approved these changes Jan 11, 2026
108-124: Verify Windows polluters list is intentionally empty.The
ENV_POLLUTING_TESTS_WINDOWSlist is empty while Linux and macOS have several entries. Based on the PR description mentioning ongoing Windows bisecting work, is this intentional or does it indicate work in progress?
297-320: LGTM: Clean separation between normal runs and polluter verification.The
RUSTPYTHON_SKIP_ENV_POLLUTERSflag correctly skips known polluters during regular test runs while the dedicated verification steps (added later) specifically test those polluters. This is a sound architectural choice.
136-136: LGTM: Formatting improvements enhance consistency.The formatting changes throughout the file improve readability and maintain consistency in the workflow structure without affecting functionality.
Also applies to: 167-167, 179-182, 432-432, 469-469, 484-485, 492-494
323-349: The exit code 3 assumption in the workflow is correct.Exit code 3 is indeed the correct signal from CPython's test framework when
--fail-env-changeddetects environment pollution. This is confirmed in CPython's/usr/lib/python3.11/test/libregrtest/main.pywhere the code explicitly returnssys.exit(3)when both the--fail-env-changedflag is set and environment changes are detected. The workflow logic correctly relies on this exit code to determine if a test is still polluting the environment.
View reviewed changes
youknowone left a comment
Copy link Copy Markdown
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
Thank you so much!
youknowone merged commit1d95a04
into
RustPython : main
Jan 11, 2026
fanninpm
deleted the
update-libregrtest
branch
January 11, 2026 18:43
This was referenced Jan 11, 2026
Optimize CI cache usage
#6707
Merged
Added a test updater tool
#6709
Closed
fanninpm
mentioned this pull request
Jan 30, 2026
Regrtest upgrade
#5752
Closed
This was referenced Feb 1, 2026
Update test_unpack_ex from v3.14.2
#6945
Merged
RustPython version to 3.14.3
#6999
Merged
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment