From 334f560320b4bec709ae7f4576173d3e55b4c8f8 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 28 Mar 2023 14:59:27 -0700 Subject: [PATCH] Backport PR #52260: CI/DEPS: Correct xfail condition for new pymysql --- pandas/tests/io/test_sql.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 2504794384038..d2fb4a8426cf8 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 ( @@ -2393,9 +2394,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)