Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions lib/matplotlib/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
from matplotlib.testing.conftest import ( # noqa
mpl_test_settings, pytest_configure, pytest_unconfigure, pd, text_placeholders, xr)
import sys
import os
import pytest

def pytest_collection_modifyitems(config, items):

Check warning on line 7 in lib/matplotlib/tests/conftest.py

View workflow job for this annotation

GitHub Actions / ruff

[rdjson] reported by reviewdog 🐶 Expected 2 blank lines, found 1 Raw Output: message:"Expected 2 blank lines, found 1" location:{path:"/home/runner/work/matplotlib/matplotlib/lib/matplotlib/tests/conftest.py" range:{start:{line:7 column:1} end:{line:7 column:4}}} severity:WARNING source:{name:"ruff" url:"https://docs.astral.sh/ruff"} code:{value:"E302" url:"https://docs.astral.sh/ruff/rules/blank-lines-top-level"} suggestions:{range:{start:{line:6 column:1} end:{line:7 column:1}} text:"\n\n"}
"""
On Windows CI, force tests that spawn fresh Python processes to run serially.

Rationale:
Tests that spawn a new Python process (via sys.executable) compete for
Desktop Heap / Handles on Windows. Running them in parallel causes
resource exhaustion and timeouts.
"""
# 1. Only apply on Windows
if sys.platform != "win32":
return

# 2. Only apply on CI (let local devs run fast)
if not os.environ.get("CI"):
return

# 3. The Specific "Python Spawning" Files
# Identified via static analysis of `sys.executable` usage.
serial_files = {
'test_backends_interactive.py',
'test_backend_webagg.py',
'test_basic.py',
'test_determinism.py',
'test_font_manager.py',
'test_matplotlib.py',
'test_preprocess_data.py',
'test_pyplot.py',
'test_rcparams.py',
'test_sphinxext.py',
'test_texmanager.py',
}

# 4. Apply the Single Group (Strict Serialization)
for item in items:
# Check if the test belongs to one of the identified files
if any(f in str(item.fspath) for f in serial_files):
item.add_marker(pytest.mark.xdist_group(name="serial_python_spawn"))

Check warning on line 44 in lib/matplotlib/tests/conftest.py

View workflow job for this annotation

GitHub Actions / ruff

[rdjson] reported by reviewdog 🐶 No newline at end of file Raw Output: message:"No newline at end of file" location:{path:"/home/runner/work/matplotlib/matplotlib/lib/matplotlib/tests/conftest.py" range:{start:{line:44 column:81} end:{line:44 column:81}}} severity:WARNING source:{name:"ruff" url:"https://docs.astral.sh/ruff"} code:{value:"W292" url:"https://docs.astral.sh/ruff/rules/missing-newline-at-end-of-file"} suggestions:{range:{start:{line:44 column:81} end:{line:44 column:81}} text:"\n"}
Loading