From ac19bb3ed51cfa14e9f5ded8f6a5ad39e1939ad2 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 14 Nov 2024 14:18:12 +0100 Subject: [PATCH] Fix CI (#3364) --- ci/scripts/min-deps.py | 2 +- ci/scripts/towncrier_automation.py | 4 +--- pyproject.toml | 4 ++-- tests/test_utils.py | 13 +++++++++---- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ci/scripts/min-deps.py b/ci/scripts/min-deps.py index b996302c01..18af6ce151 100755 --- a/ci/scripts/min-deps.py +++ b/ci/scripts/min-deps.py @@ -35,7 +35,7 @@ def min_dep(req: Requirement) -> Requirement: ------- >>> min_dep(Requirement("numpy>=1.0")) - "numpy==1.0" + """ req_name = req.name if req.extras: diff --git a/ci/scripts/towncrier_automation.py b/ci/scripts/towncrier_automation.py index fd492f494a..c532883036 100755 --- a/ci/scripts/towncrier_automation.py +++ b/ci/scripts/towncrier_automation.py @@ -66,9 +66,7 @@ def main(argv: Sequence[str] | None = None) -> None: text=True, check=True, ).stdout.strip() - pr_description = ( - "" if base_branch == "main" else "@meeseeksmachine backport to main" - ) + pr_description = "" if base_branch == "main" else "@meeseeksdev backport to main" branch_name = f"release_notes_{args.version}" # Create a new branch + commit diff --git a/pyproject.toml b/pyproject.toml index d7e790f097..cfb7ffd28a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,7 +166,7 @@ addopts = [ "-ptesting.scanpy._pytest", "--pyargs", ] -testpaths = ["./tests", "scanpy"] +testpaths = ["./tests", "./ci", "scanpy"] norecursedirs = ["tests/_images"] xfail_strict = true nunit_attach_on = "fail" @@ -211,7 +211,7 @@ exclude_also = [ "if __name__ == .__main__.:", "if TYPE_CHECKING:", # https://github.com/numba/numba/issues/4268 - "@numba.njit.*", + '@(numba\.|nb\.)njit.*', ] [tool.ruff] diff --git a/tests/test_utils.py b/tests/test_utils.py index 3bec055995..f8a38a5f9d 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,9 +6,10 @@ import numpy as np import pytest from anndata.tests.helpers import asarray +from packaging.version import Version from scipy.sparse import csr_matrix, issparse -from scanpy._compat import DaskArray +from scanpy._compat import DaskArray, pkg_version from scanpy._utils import ( axis_mul_or_truediv, axis_sum, @@ -225,11 +226,15 @@ def test_is_constant(array_type): ], ) @pytest.mark.parametrize("block_type", [np.array, csr_matrix]) -def test_is_constant_dask(axis, expected, block_type): +def test_is_constant_dask(request: pytest.FixtureRequest, axis, expected, block_type): import dask.array as da - if (axis is None) and block_type is csr_matrix: - pytest.skip("Dask has weak support for scipy sparse matrices") + if block_type is csr_matrix and ( + axis is None or pkg_version("dask") < Version("2023.2.0") + ): + reason = "Dask has weak support for scipy sparse matrices" + # This test is flaky for old dask versions, but when `axis=None` it reliably fails + request.applymarker(pytest.mark.xfail(reason=reason, strict=axis is None)) x_data = [ [0, 0, 1, 1],