Skip to content

Commit c02348d

Browse files
authored
Limit --maxprocesses for scripts/ci/run-tests when in GitHub runners (#10148)
1 parent 726639b commit c02348d

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

.github/workflows/run-dep-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
os: [ubuntu-latest, macOS-latest, windows-latest]
2020

2121
steps:
22-
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
22+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
24+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Install dependencies

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
os: [ubuntu-latest, macOS-latest, windows-latest]
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2424
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v5
25+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
2626
with:
2727
python-version: ${{ matrix.python-version }}
2828
- name: Install dependencies

.github/workflows/source-dist-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
2020
os: [ubuntu-latest, macOS-latest, windows-latest]
2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v5
24+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Install dependencies

.github/workflows/update-lockfiles.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434
os: [macOS-latest, windows-latest]
3535

3636
steps:
37-
- uses: actions/checkout@v4
37+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
3838
with:
3939
ref: ${{ github.event.inputs.ref }}
4040
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v5
41+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444

scripts/ci/run-tests

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ def process_args(args):
5252
test_args += f'--junit-xml={args.junit_xml_path} '
5353
if args.markers:
5454
test_args += f'-m {args.markers} '
55-
test_args += '--numprocesses=auto --dist=loadfile --maxprocesses=4 '
55+
if os.getenv('PYTEST_XDIST_AUTO_NUM_WORKERS'):
56+
# If the user set PYTEST_XDIST_AUTO_NUM_WORKERS,
57+
# use that to limit max processes
58+
max_processes = int(os.environ['PYTEST_XDIST_AUTO_NUM_WORKERS'])
59+
elif os.getenv('GITHUB_ACTIONS', 'false') == 'true':
60+
# Limiting parallelism in GitHub, to avoid the
61+
# 'Error: The operation was canceled.' issues in 2026
62+
max_processes=3
63+
else:
64+
max_processes=4
65+
test_args += f'--numprocesses=auto --dist=loadfile --maxprocesses={max_processes} '
5666
dirs = " ".join(args.test_dirs)
5767

5868
return runner, test_args, dirs

0 commit comments

Comments
 (0)