From dd7f22e4cd31017bca4a935dbf43fe867e2262a6 Mon Sep 17 00:00:00 2001 From: Paco Cartones Date: Fri, 28 Aug 2026 10:50:19 +0000 Subject: [PATCH 1/2] Remove stale xfail on schema-qualified INSERT parseutils test test_simple_insert_single_table_schema_qualified was marked xfail for an old sqlparse that mislabeled schema-qualified INSERT statements. That is long fixed: the test passes across the supported range (sqlparse 0.3.0 through 0.6.x), so the marker only produced an XPASS. Because xfail_strict is not set, that XPASS was silent and the assertion never gated anything. Drop the decorator so the test guards extract_tables again. --- AUTHORS | 1 + changelog.rst | 5 +++++ tests/parseutils/test_parseutils.py | 1 - 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index db49b9eb4..88abeccb3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -154,6 +154,7 @@ Contributors: * Diego * Chris (ChrisJr404) * Pieter Ouwerkerk (pouwerkerk) + * Paco Cartones (pacocartones) Creator: -------- diff --git a/changelog.rst b/changelog.rst index 0fe57c725..36a9da31d 100644 --- a/changelog.rst +++ b/changelog.rst @@ -9,6 +9,11 @@ Internal: ``Scenario: edit sql in file with external editor`` as an error. Raised to 10 seconds; passing runs are unaffected because pexpect returns as soon as the expected text appears. +* Remove a stale ``@pytest.mark.xfail`` on + ``test_simple_insert_single_table_schema_qualified``. It was marked for an old + ``sqlparse`` that mislabeled schema-qualified ``INSERT``; the test now passes + across the supported ``sqlparse`` range (0.3.0 to 0.6.x), so the marker only + hid a passing test (an unreported XPASS, since ``xfail_strict`` is not set). Bug fixes: ---------- diff --git a/tests/parseutils/test_parseutils.py b/tests/parseutils/test_parseutils.py index 90749ebfc..e9cc1d117 100644 --- a/tests/parseutils/test_parseutils.py +++ b/tests/parseutils/test_parseutils.py @@ -106,7 +106,6 @@ def test_simple_insert_single_table(): assert tables == ((None, "abc", "abc", False),) -@pytest.mark.xfail def test_simple_insert_single_table_schema_qualified(): tables = extract_tables('insert into abc.def (id, name) values (1, "def")') assert tables == (("abc", "def", None, False),) From 15e7a62cb6e4cb0c13b958098d54eb0fe584c6da Mon Sep 17 00:00:00 2001 From: Paco Cartones Date: Fri, 4 Sep 2026 01:23:21 +0000 Subject: [PATCH 2/2] Document the still-needed xfail on the multi-column sub-select test dbaty asked whether the xfail on test_sub_select_multiple_col_name_completion (added in 4e862015 in 2015, without explanation) is still needed. It is: removing the marker makes the test fail on sqlparse 0.6.0. Parsing the incomplete 'SELECT a, FROM abc' still treats the token before the trailing comma ('a') as a table, so the Column suggestion carries table_refs for both 'a' and 'abc' instead of just 'abc'. Keep the marker but give it a reason so the 2015 gap dbaty flagged is closed: future readers see why the failure is expected instead of an undocumented decorator. --- changelog.rst | 7 +++++++ tests/test_sqlcompletion.py | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/changelog.rst b/changelog.rst index 36a9da31d..52686a233 100644 --- a/changelog.rst +++ b/changelog.rst @@ -14,6 +14,13 @@ Internal: ``sqlparse`` that mislabeled schema-qualified ``INSERT``; the test now passes across the supported ``sqlparse`` range (0.3.0 to 0.6.x), so the marker only hid a passing test (an unreported XPASS, since ``xfail_strict`` is not set). +* Document the still-needed ``@pytest.mark.xfail`` on + ``test_sub_select_multiple_col_name_completion``, which was added in 2015 + without explanation. The parser still misidentifies the token before the + trailing comma in an incomplete multi-column sub-select + (``SELECT a, FROM abc``) as a table, so the marker now carries a ``reason`` + recording that this remains an expected failure on the supported + ``sqlparse`` range. Bug fixes: ---------- diff --git a/tests/test_sqlcompletion.py b/tests/test_sqlcompletion.py index 9deb3455d..20abb99a9 100644 --- a/tests/test_sqlcompletion.py +++ b/tests/test_sqlcompletion.py @@ -450,7 +450,12 @@ def test_sub_select_col_name_completion(): } -@pytest.mark.xfail +@pytest.mark.xfail( + reason="Parsing an incomplete multi-column sub-select still misidentifies the " + "token before the trailing comma as a table: 'SELECT a, FROM abc' yields " + "table_refs for both 'a' and 'abc' instead of just 'abc'. Confirmed still " + "failing on sqlparse 0.6.0." +) def test_sub_select_multiple_col_name_completion(): suggestions = suggest_type("SELECT * FROM (SELECT a, FROM abc", "SELECT * FROM (SELECT a, ") assert set(suggestions) == cols_etc("abc")