Skip to content

Commit 82c9c4e

Browse files
chore: update pytest config (#638)
* chore: update pytest config Signed-off-by: Henry Schreiner <[email protected]> * Disable benchmarking in CI pytest command Disable benchmarking during pytest runs. * tests: no use of asyncio Signed-off-by: Henry Schreiner <[email protected]> * Update filterwarnings in pyproject.toml Add additional filter warning for urllib3 in pytest configuration. * Update urllib3 warning message in pyproject.toml * Add RuntimeWarning filter to pytest configuration --------- Signed-off-by: Henry Schreiner <[email protected]> Co-authored-by: Andrzej Novak <[email protected]>
1 parent 566ad91 commit 82c9c4e

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
6969
- name: Test with pytest
7070
run: |
71-
python -m pytest -r sa --mpl --mpl-results-path=pytest_results -n 4
71+
python -m pytest -r sa --mpl --mpl-results-path=pytest_results -n 4 --benchmark-disable
7272
7373
- name: Upload pytest test results
7474
uses: actions/upload-artifact@v5

pyproject.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,20 @@ ignore_missing_imports = true
129129
# Additional configuration is in matplotlib/testing/conftest.py.
130130
[tool.pytest.ini_options]
131131
minversion = 6.0
132-
testpaths = ["tests"]
132+
addopts = ["-ra", "--strict-markers"] # need to fix pytest dependency installs to enable --strict-config
133+
filterwarnings = [
134+
"error",
135+
"default:urllib3 v2 only supports OpenSSL",
136+
"default:invalid value encountered in _fmt:RuntimeWarning",
137+
]
138+
log_level = "INFO"
133139
python_files = "test*.py"
134-
asyncio_default_fixture_loop_scope = "session"
140+
testpaths = ["tests"]
141+
xfail_strict = true
142+
markers = [
143+
"latex: tests that require LaTeX to be installed",
144+
]
145+
135146

136147
[tool.ruff.lint]
137148
extend-select = [

tests/conftest.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,6 @@
55
import pytest
66

77

8-
def pytest_configure(config):
9-
"""Configure pytest to handle pytest-xdist + pytest-asyncio compatibility."""
10-
# Disable pytest-asyncio when running with pytest-xdist to avoid warnings
11-
# This is the recommended fix from pytest-xdist documentation
12-
if hasattr(config.option, "numprocesses") and config.option.numprocesses:
13-
# Running with xdist, disable pytest-asyncio
14-
config.pluginmanager.set_blocked("pytest_asyncio")
15-
16-
# Register custom markers
17-
config.addinivalue_line(
18-
"markers", "latex: tests that require LaTeX to be installed"
19-
)
20-
21-
228
def _has_latex():
239
"""Check if LaTeX is available on the system."""
2410
if not shutil.which("latex"):

0 commit comments

Comments
 (0)