Skip to content

Commit e6246f7

Browse files
rhshadrachpmhatre1
authored andcommitted
CI: autouse add_doctest_imports (pandas-dev#57122)
* CI: autouse add_doctest_imports * add ref
1 parent 110b231 commit e6246f7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pandas/conftest.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,6 @@ def pytest_collection_modifyitems(items, config) -> None:
190190

191191
if is_doctest:
192192
for item in items:
193-
# autouse=True for the add_doctest_imports can lead to expensive teardowns
194-
# since doctest_namespace is a session fixture
195-
item.add_marker(pytest.mark.usefixtures("add_doctest_imports"))
196-
197193
for path, message in ignored_doctest_warnings:
198194
ignore_doctest_warning(item, path, message)
199195

@@ -250,7 +246,14 @@ def pytest_collection_modifyitems(items, config) -> None:
250246
)
251247

252248

253-
@pytest.fixture
249+
# ----------------------------------------------------------------
250+
# Autouse fixtures
251+
# ----------------------------------------------------------------
252+
253+
254+
# https://github.com/pytest-dev/pytest/issues/11873
255+
# Would like to avoid autouse=True, but cannot as of pytest 8.0.0
256+
@pytest.fixture(autouse=True)
254257
def add_doctest_imports(doctest_namespace) -> None:
255258
"""
256259
Make `np` and `pd` names available for doctests.
@@ -259,9 +262,6 @@ def add_doctest_imports(doctest_namespace) -> None:
259262
doctest_namespace["pd"] = pd
260263

261264

262-
# ----------------------------------------------------------------
263-
# Autouse fixtures
264-
# ----------------------------------------------------------------
265265
@pytest.fixture(autouse=True)
266266
def configure_tests() -> None:
267267
"""

0 commit comments

Comments
 (0)