Scrapy, a fast high-level web crawling & scraping framework for Python.
CI: Run coverage in as few jobs as necessary (#7834)
Adrian259be5d2dd02
diff --git a/.github/workflows/tests-macos.yml b/.github/workflows/tests-macos.ymlindex 0409b3ef2..566b34e50 100644--- a/.github/workflows/tests-macos.yml+++ b/.github/workflows/tests-macos.yml@@ -14,14 +14,18 @@ jobs:tests:runs-on: macos-latestenv:- PYTEST_ADDOPTS: -n auto+ PYTEST_ADDOPTS: ${{ matrix.coverage && '-n auto' || '-n auto --no-cov' }}strategy:fail-fast: falsematrix:- python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]+ python-version: ["3.10", "3.11", "3.12", "3.13"]env:- TOXENV: pyinclude:+ - python-version: '3.14'+ env:+ TOXENV: py+ coverage: true- python-version: '3.14'env:TOXENV: no-reactor@@ -41,6 +45,7 @@ jobs:tox- name: Upload coverage report+ if: ${{ matrix.coverage }}uses: codecov/codecov-action@v5- name: Upload test resultsdiff --git a/.github/workflows/tests-ubuntu.yml b/.github/workflows/tests-ubuntu.ymlindex 15f25d9b8..ad2bcfce7 100644--- a/.github/workflows/tests-ubuntu.yml+++ b/.github/workflows/tests-ubuntu.yml@@ -14,7 +14,7 @@ jobs:tests:runs-on: ubuntu-latestenv:- PYTEST_ADDOPTS: -n auto+ PYTEST_ADDOPTS: ${{ matrix.coverage && '-n auto' || '-n auto --no-cov' }}strategy:fail-fast: falsematrix:@@ -34,12 +34,15 @@ jobs:- python-version: "3.14"env:TOXENV: py+ coverage: true- python-version: "3.14"env:TOXENV: default-reactor+ coverage: true- python-version: "3.14"env:TOXENV: no-reactor+ coverage: true# pinned due to https://github.com/pypy/pypy/issues/5388- python-version: pypy3.11-7.3.20env:@@ -49,12 +52,15 @@ jobs:- python-version: "3.10.19"env:TOXENV: min+ coverage: true- python-version: "3.10.19"env:TOXENV: min-default-reactor+ coverage: true- python-version: "3.10.19"env:TOXENV: min-no-reactor+ coverage: true# pinned due to https://github.com/pypy/pypy/issues/5388- python-version: pypy3.11-7.3.20env:@@ -62,16 +68,20 @@ jobs:- python-version: "3.10.19"env:TOXENV: min-extra-deps+ coverage: true- python-version: "3.10.19"env:TOXENV: min-botocore+ coverage: true- python-version: "3.14"env:TOXENV: extra-deps+ coverage: true- python-version: "3.14"env:TOXENV: no-reactor-extra-deps+ coverage: true# pinned due to https://github.com/pypy/pypy/issues/5388- python-version: pypy3.11-7.3.20env:@@ -79,6 +89,7 @@ jobs:- python-version: "3.14"env:TOXENV: botocore+ coverage: truesteps:- uses: actions/checkout@v6@@ -104,6 +115,7 @@ jobs:tox- name: Upload coverage report+ if: ${{ matrix.coverage }}uses: codecov/codecov-action@v5- name: Upload test resultsdiff --git a/.github/workflows/tests-windows.yml b/.github/workflows/tests-windows.ymlindex f413782bc..c33f96b12 100644--- a/.github/workflows/tests-windows.yml+++ b/.github/workflows/tests-windows.yml@@ -14,7 +14,7 @@ jobs:tests:runs-on: windows-latestenv:- PYTEST_ADDOPTS: -n auto+ PYTEST_ADDOPTS: ${{ matrix.coverage && '-n auto' || '-n auto --no-cov' }}strategy:fail-fast: falsematrix:@@ -34,6 +34,7 @@ jobs:- python-version: "3.14"env:TOXENV: py+ coverage: true- python-version: "3.14"env:TOXENV: default-reactor@@ -68,6 +69,7 @@ jobs:tox- name: Upload coverage report+ if: ${{ matrix.coverage }}uses: codecov/codecov-action@v5- name: Upload test resultsdiff --git a/tests/test_utils_console.py b/tests/test_utils_console.pyindex ad9aa3dff..ab0c72d8a 100644--- a/tests/test_utils_console.py+++ b/tests/test_utils_console.py@@ -4,7 +4,7 @@ from importlib.util import find_specimport pytest-from scrapy.utils.console import get_shell_embed_func+from scrapy.utils.console import get_shell_embed_func, start_python_consoledef test_get_shell_embed_func():@@ -59,3 +59,20 @@ def test_get_shell_embed_func_default():else:expected = "_embed_standard_shell"assert shell.__name__ == expected+++def test_start_python_console_exit(monkeypatch: pytest.MonkeyPatch) -> None:+ def embed(namespace: dict[str, object], banner: str) -> None:+ raise SystemExit++ monkeypatch.setattr(+ "scrapy.utils.console.get_shell_embed_func", lambda shells: embed+ )+ start_python_console()+++def test_start_python_console_no_shell(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(+ "scrapy.utils.console.get_shell_embed_func", lambda shells: None+ )+ start_python_console()