Skip to content

Commit c0e6a1d

Browse files
Attempt to fix issue with show_versions and pandas>=3.0.0
1 parent 7f35ae4 commit c0e6a1d

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

tests/test_utility.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from contextlib import (
2-
AbstractContextManager,
3-
nullcontext,
4-
)
1+
from contextlib import nullcontext
52
import platform
63

74
import pandas as pd
@@ -17,17 +14,25 @@
1714

1815

1916
def test_show_version():
20-
with pytest_warns_bounded(
21-
UserWarning,
22-
match="Setuptools is replacing distutils",
23-
upper="3.11.99",
24-
version_str=platform.python_version(),
25-
):
26-
context: AbstractContextManager
27-
if PD_LTE_22 and NUMPY20: # https://github.com/PyTables/PyTables/issues/1172
17+
"""Test show_versions method types with split case for pandas and python versions."""
18+
# https://github.com/PyTables/PyTables/issues/1172
19+
context = nullcontext()
20+
if PD_LTE_22:
21+
# distutils warning is only raised with pandas<3.0.0
22+
if NUMPY20:
2823
context = pytest.raises(ValueError)
29-
else:
30-
context = nullcontext()
24+
with (
25+
pytest_warns_bounded(
26+
UserWarning,
27+
match="Setuptools is replacing distutils",
28+
upper="3.11.99",
29+
version_str=platform.python_version(),
30+
),
31+
context,
32+
):
33+
check(assert_type(pd.show_versions(True), None), type(None))
34+
check(assert_type(pd.show_versions(False), None), type(None))
35+
else:
3136
with context:
3237
check(assert_type(pd.show_versions(True), None), type(None))
3338
check(assert_type(pd.show_versions(False), None), type(None))

0 commit comments

Comments
 (0)