Skip to content

Commit fd0c3f5

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

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

tests/test_utility.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,26 @@
1717

1818

1919
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
28-
context = pytest.raises(ValueError)
29-
else:
30-
context = nullcontext()
31-
with context:
32-
check(assert_type(pd.show_versions(True), None), type(None))
33-
check(assert_type(pd.show_versions(False), None), type(None))
20+
"""Test show_versions method types with split case for pandas and python versions."""
21+
if PD_LTE_22:
22+
# distutils warning is only raised with pandas<3.0.0
23+
with pytest_warns_bounded(
24+
UserWarning,
25+
match="Setuptools is replacing distutils",
26+
upper="3.11.99",
27+
version_str=platform.python_version(),
28+
):
29+
context: AbstractContextManager
30+
if NUMPY20: # https://github.com/PyTables/PyTables/issues/1172
31+
context = pytest.raises(ValueError)
32+
else:
33+
context = nullcontext()
34+
with context:
35+
check(assert_type(pd.show_versions(True), None), type(None))
36+
check(assert_type(pd.show_versions(False), None), type(None))
37+
else:
38+
check(assert_type(pd.show_versions(True), None), type(None))
39+
check(assert_type(pd.show_versions(False), None), type(None))
3440

3541

3642
def test_dummies():

0 commit comments

Comments
 (0)