Skip to content

Commit 81cdbb4

Browse files
authored
DOC: Run doctests over pandas directory (#45056)
1 parent 5601728 commit 81cdbb4

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

ci/code_checks.sh

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,8 @@ fi
6565
if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
6666

6767
MSG='Doctests' ; echo $MSG
68-
python -m pytest --doctest-modules \
69-
pandas/_config/ \
70-
pandas/_libs/ \
71-
pandas/_testing/ \
72-
pandas/api/ \
73-
pandas/arrays/ \
74-
pandas/compat/ \
75-
pandas/core \
76-
pandas/errors/ \
77-
pandas/io/ \
78-
pandas/plotting/ \
79-
pandas/tseries/ \
80-
pandas/util/ \
81-
pandas/_typing.py \
82-
pandas/_version.py \
83-
pandas/conftest.py \
84-
pandas/testing.py
68+
# Ignore test_*.py files or else the unit tests will run
69+
python -m pytest --doctest-modules --ignore-glob="**/test_*.py" pandas
8570
RET=$(($RET + $?)) ; echo $MSG "DONE"
8671

8772
MSG='Cython Doctests' ; echo $MSG

pandas/tests/arithmetic/conftest.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def switch_numexpr_min_elements(request):
2424

2525
# ------------------------------------------------------------------
2626

27-
27+
# doctest with +SKIP for one fixture fails during setup with
28+
# 'DoctestItem' object has no attribute 'callspec'
29+
# due to switch_numexpr_min_elements fixture
2830
@pytest.fixture(params=[1, np.array(1, dtype=np.int64)])
2931
def one(request):
3032
"""
@@ -37,11 +39,11 @@ def one(request):
3739
3840
Examples
3941
--------
40-
>>> dti = pd.date_range('2016-01-01', periods=2, freq='H')
41-
>>> dti
42+
dti = pd.date_range('2016-01-01', periods=2, freq='H')
43+
dti
4244
DatetimeIndex(['2016-01-01 00:00:00', '2016-01-01 01:00:00'],
4345
dtype='datetime64[ns]', freq='H')
44-
>>> dti + one
46+
dti + one
4547
DatetimeIndex(['2016-01-01 01:00:00', '2016-01-01 02:00:00'],
4648
dtype='datetime64[ns]', freq='H')
4749
"""
@@ -61,6 +63,9 @@ def one(request):
6163
zeros.extend([0, 0.0, -0.0])
6264

6365

66+
# doctest with +SKIP for zero fixture fails during setup with
67+
# 'DoctestItem' object has no attribute 'callspec'
68+
# due to switch_numexpr_min_elements fixture
6469
@pytest.fixture(params=zeros)
6570
def zero(request):
6671
"""
@@ -74,8 +79,8 @@ def zero(request):
7479
7580
Examples
7681
--------
77-
>>> arr = RangeIndex(5)
78-
>>> arr / zeros
82+
arr = RangeIndex(5)
83+
arr / zeros
7984
Float64Index([nan, inf, inf, inf, inf], dtype='float64')
8085
"""
8186
return request.param

0 commit comments

Comments
 (0)