From 7f1ca40214bffae960af3f70f647af814ce91a5e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:15:42 +0100 Subject: [PATCH 1/3] Run CI witb max cores --- .github/workflows/ci.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b99b8a162d..7fd226ef9d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -302,17 +302,24 @@ jobs: run: python -m pip install -r requirements.txt && pytest -v working-directory: ./extra_tests + - name: Detect available cores + id: cores + shell: bash + run: | + cores=$(python -c 'print(__import__("os").process_cpu_count())') + echo "cores=${cores}" >> $GITHUB_OUTPUT + - name: run cpython platform-independent tests if: runner.os == 'Linux' run: | - target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} + target/release/rustpython -m test -j ${{ steps.cores.outputs.cores }} -u all --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} timeout-minutes: 45 env: RUSTPYTHON_SKIP_ENV_POLLUTERS: true - name: run cpython platform-dependent tests run: | - target/release/rustpython -m test -j 1 ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ join(matrix.skips, ' ') }} + target/release/rustpython -m test -j ${{ steps.cores.outputs.cores }} ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ join(matrix.skips, ' ') }} timeout-minutes: ${{ matrix.timeout }} env: RUSTPYTHON_SKIP_ENV_POLLUTERS: true From ea0d06e90434f9d01ab496794f828aa7bb3b432a Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Tue, 17 Mar 2026 14:45:50 +0100 Subject: [PATCH 2/3] Step for flaky MP tests --- .github/workflows/ci.yaml | 91 +++++---------------------------------- 1 file changed, 11 insertions(+), 80 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7fd226ef9d..d368de3e9c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -176,80 +176,12 @@ jobs: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} env: RUST_BACKTRACE: full - # PLATFORM_INDEPENDENT_TESTS are tests that do not depend on the underlying OS. - # They are currently only run on Linux to speed up the CI. - PLATFORM_INDEPENDENT_TESTS: >- - test__colorize - test_array - test_asyncgen - test_binop - test_bisect - test_bool - test_bytes - test_call - test_class - test_cmath - test_collections - test_complex - test_contains - test_copy - test_dataclasses - test_decimal - test_decorators - test_defaultdict - test_deque - test_dict - test_dictcomps - test_dictviews - test_dis - test_enumerate - test_exception_variations - test_float - test_format - test_fractions - test_genericalias - test_genericclass - test_grammar - test_range - test_index - test_int - test_int_literal - test_isinstance - test_iter - test_iterlen - test_itertools - test_json - test_keyword - test_keywordonlyarg - test_list - test_long - test_longexp - test_math - test_operator - test_ordered_dict - test_pep646_syntax - test_pow - test_raise - test_richcmp - test_scope - test_set - test_slice - test_sort - test_string - test_string_literals - test_strtod - test_structseq - test_subclassinit - test_super - test_syntax - test_tstring - test_tuple - test_types - test_unary - test_unpack - test_unpack_ex - test_weakref - test_yield_from + # Tests that can be flaky when running with multiple processes `-j 2`. We will use `-j 1` for these. + FLAKY_MP_TESTS: >- + test_eintr + test_multiprocessing_fork + test_multiprocessing_forkserver + test_multiprocessing_spawn name: Run snippets and cpython tests runs-on: ${{ matrix.os }} strategy: @@ -309,17 +241,16 @@ jobs: cores=$(python -c 'print(__import__("os").process_cpu_count())') echo "cores=${cores}" >> $GITHUB_OUTPUT - - name: run cpython platform-independent tests - if: runner.os == 'Linux' + - name: Run CPython tests run: | - target/release/rustpython -m test -j ${{ steps.cores.outputs.cores }} -u all --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} - timeout-minutes: 45 + target/release/rustpython -m test -j ${{ steps.cores.outputs.cores }} ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v -x ${{ env.FLAKY_MP_TESTS }} ${{ join(matrix.skips, ' ') }} + timeout-minutes: ${{ matrix.timeout }} env: RUSTPYTHON_SKIP_ENV_POLLUTERS: true - - name: run cpython platform-dependent tests + - name: Run flaky MP CPython tests run: | - target/release/rustpython -m test -j ${{ steps.cores.outputs.cores }} ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ join(matrix.skips, ' ') }} + target/release/rustpython -m test -j 1 ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v ${{ env.FLAKY_MP_TESTS }} timeout-minutes: ${{ matrix.timeout }} env: RUSTPYTHON_SKIP_ENV_POLLUTERS: true From 04274b45e68b7d258b349791703d0268586ee18e Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:55:27 +0100 Subject: [PATCH 3/3] Add `test_class` to flkay mp tests --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0bebdeba0a..c32ab12c39 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -182,6 +182,7 @@ jobs: RUST_BACKTRACE: full # Tests that can be flaky when running with multiple processes `-j 2`. We will use `-j 1` for these. FLAKY_MP_TESTS: >- + test_class test_eintr test_multiprocessing_fork test_multiprocessing_forkserver