Skip to content

Commit 1a75f49

Browse files
DOC: make it possible to run doctests (#15626)
1 parent 54e71a7 commit 1a75f49

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/conftest.py

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import pytest
22

3+
import numpy
4+
import pandas
5+
36

47
def pytest_addoption(parser):
58
parser.addoption("--skip-slow", action="store_true",
@@ -19,3 +22,11 @@ def pytest_runtest_setup(item):
1922

2023
if 'network' in item.keywords and item.config.getoption("--skip-network"):
2124
pytest.skip("skipping due to --skip-network")
25+
26+
27+
# For running doctests: make np and pd names available
28+
29+
@pytest.fixture(autouse=True)
30+
def add_imports(doctest_namespace):
31+
doctest_namespace['np'] = numpy
32+
doctest_namespace['pd'] = pandas

0 commit comments

Comments
 (0)