Skip to content

Commit

Permalink
Backport PR pandas-dev#57122: CI: autouse add_doctest_imports
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach authored and meeseeksmachine committed Jan 29, 2024
1 parent c1723cd commit 630bb34
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ def pytest_collection_modifyitems(items, config) -> None:

if is_doctest:
for item in items:
# autouse=True for the add_doctest_imports can lead to expensive teardowns
# since doctest_namespace is a session fixture
item.add_marker(pytest.mark.usefixtures("add_doctest_imports"))

for path, message in ignored_doctest_warnings:
ignore_doctest_warning(item, path, message)

Expand Down Expand Up @@ -250,7 +246,14 @@ def pytest_collection_modifyitems(items, config) -> None:
)


@pytest.fixture
# ----------------------------------------------------------------
# Autouse fixtures
# ----------------------------------------------------------------


# https://github.com/pytest-dev/pytest/issues/11873
# Would like to avoid autouse=True, but cannot as of pytest 8.0.0
@pytest.fixture(autouse=True)
def add_doctest_imports(doctest_namespace) -> None:
"""
Make `np` and `pd` names available for doctests.
Expand All @@ -259,9 +262,6 @@ def add_doctest_imports(doctest_namespace) -> None:
doctest_namespace["pd"] = pd


# ----------------------------------------------------------------
# Autouse fixtures
# ----------------------------------------------------------------
@pytest.fixture(autouse=True)
def configure_tests() -> None:
"""
Expand Down

0 comments on commit 630bb34

Please sign in to comment.