Skip to content

Commit

Permalink
(fix): remove runtime pytest dep
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan-gold committed Feb 25, 2025
1 parent 20e2d1b commit 0b52461
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/anndata/experimental/backed/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from anndata._io.specs.registry import read_elem_lazy
from anndata._types import AnnDataElem
from testing.anndata._pytest import doctest_needs
from testing.anndata._doctest import doctest_needs

from ..._core.anndata import AnnData
from ..._settings import settings
Expand Down
16 changes: 16 additions & 0 deletions src/testing/anndata/_doctest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from __future__ import annotations

from collections.abc import Callable
from typing import TypeVar

F = TypeVar("F", bound=Callable)


def doctest_needs(mod: str) -> Callable[[F], F]:
"""Mark function with doctest dependency."""

def decorator(func: F) -> F:
func._doctest_needs = mod
return func

return decorator
15 changes: 1 addition & 14 deletions src/testing/anndata/_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
import pytest

if TYPE_CHECKING:
from collections.abc import Callable, Generator, Iterable
from collections.abc import Generator, Iterable
from pathlib import Path
from typing import TypeVar

F = TypeVar("F", bound=Callable)


# TODO: Should be done in pyproject.toml eventually
Expand All @@ -44,16 +41,6 @@ def _anndata_test_env(request: pytest.FixtureRequest) -> None:
anndata.settings.reset(anndata.settings._registered_options.keys())


def doctest_needs(mod: str) -> Callable[[F], F]:
"""Mark function with doctest dependency."""

def decorator(func: F) -> F:
func._doctest_needs = mod
return func

return decorator


@pytest.fixture
def _doctest_env(
request: pytest.FixtureRequest, cache: pytest.Cache, tmp_path: Path
Expand Down

0 comments on commit 0b52461

Please sign in to comment.