diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index ab88e4ccd8b82..cd1f0ce6fcfd8 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -59,6 +59,7 @@ ArrowStringArray, StringArray, ) +from pandas.util.version import Version from pandas.io import sql from pandas.io.sql import ( @@ -2397,9 +2398,12 @@ def test_to_sql_with_negative_npinf(self, input, request): # The input {"foo": [-np.inf], "infe0": ["bar"]} does not raise any error # for pymysql version >= 0.10 # TODO(GH#36465): remove this version check after GH 36465 is fixed - import pymysql + pymysql = pytest.importorskip("pymysql") - if pymysql.VERSION[0:3] >= (0, 10, 0) and "infe0" in df.columns: + if ( + Version(pymysql.__version__) < Version("1.0.3") + and "infe0" in df.columns + ): mark = pytest.mark.xfail(reason="GH 36465") request.node.add_marker(mark)