From 0d128ccc28bbabfc36869bb748e3aa9f5e09e430 Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Sun, 4 Jan 2026 15:11:20 -0500 Subject: [PATCH] Check 10 times if a test is still polluting the environment --- .github/workflows/ci.yaml | 48 +++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6b641b8a3..4cb2528a0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -337,12 +337,18 @@ jobs: shell: bash run: | for thing in ${{ env.ENV_POLLUTING_TESTS_COMMON }} ${{ env.ENV_POLLUTING_TESTS_LINUX }}; do - set +e - target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v ${thing} - exit_code=$? - set -e + 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!" + echo "Test ${thing} is no longer polluting the environment after ${i} attempts!" exit 1 fi done @@ -352,12 +358,18 @@ jobs: name: run cpython tests to check if env polluters have stopped polluting (Common/macOS) run: | for thing in ${{ env.ENV_POLLUTING_TESTS_COMMON }} ${{ env.ENV_POLLUTING_TESTS_MACOS }}; do - set +e - target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v ${thing} - exit_code=$? - set -e + 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!" + echo "Test ${thing} is no longer polluting the environment after ${i} attempts!" exit 1 fi done @@ -368,12 +380,18 @@ jobs: shell: bash run: | for thing in ${{ env.ENV_POLLUTING_TESTS_COMMON }} ${{ env.ENV_POLLUTING_TESTS_WINDOWS }}; do - set +e - target/release/rustpython -m test -j 1 --slowest --fail-env-changed --timeout 600 -v ${thing} - exit_code=$? - set -e + 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!" + echo "Test ${thing} is no longer polluting the environment after ${i} attempts!" exit 1 fi done