From 0821f4bfe274d20d114cd1b88e0c965dd8677f11 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. --- tests/parseutils/test_parseutils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/parseutils/test_parseutils.py b/tests/parseutils/test_parseutils.py index 02341125f..d1221f86e 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 18f469ced2c160f66b95663bcf98c8a9af5e697b Mon Sep 17 00:00:00 2001 From: Paco Cartones Date: Thu, 8 Oct 2026 12:47:14 +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. --- tests/test_sqlcompletion.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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")