@@ -180,76 +180,13 @@ jobs:
180180 if : ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
181181 env :
182182 RUST_BACKTRACE : full
183- # PLATFORM_INDEPENDENT_TESTS are tests that do not depend on the underlying OS.
184- # They are currently only run on Linux to speed up the CI.
185- PLATFORM_INDEPENDENT_TESTS : >-
186- test__colorize
187- test_array
188- test_asyncgen
189- test_binop
190- test_bisect
191- test_bool
192- test_bytes
193- test_call
194- test_cmath
195- test_collections
196- test_complex
197- test_contains
198- test_copy
199- test_dataclasses
200- test_decimal
201- test_decorators
202- test_defaultdict
203- test_deque
204- test_dict
205- test_dictcomps
206- test_dictviews
207- test_dis
208- test_enumerate
209- test_exception_variations
210- test_float
211- test_fractions
212- test_genericalias
213- test_genericclass
214- test_grammar
215- test_range
216- test_index
217- test_int
218- test_int_literal
219- test_isinstance
220- test_iter
221- test_iterlen
222- test_itertools
223- test_json
224- test_keyword
225- test_keywordonlyarg
226- test_list
227- test_long
228- test_longexp
229- test_operator
230- test_ordered_dict
231- test_pep646_syntax
232- test_pow
233- test_raise
234- test_richcmp
235- test_scope
236- test_set
237- test_slice
238- test_sort
239- test_string
240- test_string_literals
241- test_strtod
242- test_structseq
243- test_subclassinit
244- test_super
245- test_syntax
246- test_tstring
247- test_tuple
248- test_unary
249- test_unpack
250- test_unpack_ex
251- test_weakref
252- test_yield_from
183+ # Tests that can be flaky when running with multiple processes `-j 2`. We will use `-j 1` for these.
184+ FLAKY_MP_TESTS : >-
185+ test_class
186+ test_eintr
187+ test_multiprocessing_fork
188+ test_multiprocessing_forkserver
189+ test_multiprocessing_spawn
253190 name : Run snippets and cpython tests
254191 runs-on : ${{ matrix.os }}
255192 strategy :
@@ -304,17 +241,23 @@ jobs:
304241 run : python -m pip install -r requirements.txt && pytest -v
305242 working-directory : ./extra_tests
306243
307- - name : run cpython platform-independent tests
308- if : runner.os == 'Linux'
244+ - name : Detect available cores
245+ id : cores
246+ shell : bash
309247 run : |
310- target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
311- timeout-minutes : 45
248+ cores=$(python -c 'print(__import__("os").process_cpu_count())')
249+ echo "cores=${cores}" >> $GITHUB_OUTPUT
250+
251+ - name : Run CPython tests
252+ run : |
253+ 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, ' ') }}
254+ timeout-minutes : ${{ matrix.timeout }}
312255 env :
313256 RUSTPYTHON_SKIP_ENV_POLLUTERS : true
314257
315- - name : run cpython platform-dependent tests
258+ - name : Run flaky MP CPython tests
316259 run : |
317- 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, ' ') }}
260+ target/release/rustpython -m test -j 1 ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v ${{ env.FLAKY_MP_TESTS }}
318261 timeout-minutes : ${{ matrix.timeout }}
319262 env :
320263 RUSTPYTHON_SKIP_ENV_POLLUTERS : true
0 commit comments