public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/mycli] f44: Add patch to let test suite pass with pygments 2.20
@ 2026-11-15 9:28
0 siblings, 0 replies; only message in thread
From: @ 2026-11-15 9:28 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/mycli
Branch : f44
Commit : dcdc20a75aea85ac5b14b554bc2c90acf4ac5709
Author : Terje Røsten <terjeros@gmail.com>
Date : 2026-05-14T15:38:58+02:00
Stats : +160/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/mycli/c/dcdc20a75aea85ac5b14b554bc2c90acf4ac5709?branch=f44
Log:
Add patch to let test suite pass with pygments 2.20
---
diff --git a/0008-Adapt-test-suite-to-pygments-2.20.patch b/0008-Adapt-test-suite-to-pygments-2.20.patch
new file mode 100644
index 0000000..ebd3c60
--- /dev/null
+++ b/0008-Adapt-test-suite-to-pygments-2.20.patch
@@ -0,0 +1,155 @@
+From 0db5eb63b7d94ae357cad06f0ed8f91e2d6f6059 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Terje=20R=C3=B8sten?= <terjeros@gmail.com>
+Date: Thu, 14 May 2026 15:30:29 +0200
+Subject: [PATCH 8/8] Adapt test suite to pygments 2.20
+
+---
+ test/test_naive_completion.py | 8 ++++-
+ ...est_smart_completion_public_schema_only.py | 36 +++++++++++++++++--
+ test/utils.py | 7 +++-
+ 3 files changed, 46 insertions(+), 5 deletions(-)
+
+diff --git a/test/test_naive_completion.py b/test/test_naive_completion.py
+index fd4be76..1414f6a 100644
+--- a/test/test_naive_completion.py
++++ b/test/test_naive_completion.py
+@@ -4,6 +4,7 @@ from prompt_toolkit.completion import Completion
+ from prompt_toolkit.document import Document
+ import pytest
+
++from test.utils import pygments_at_least
+
+ @pytest.fixture
+ def completer():
+@@ -37,7 +38,7 @@ def test_function_name_completion(completer, complete_event):
+ text = "SELECT MA"
+ position = len("SELECT MA")
+ result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
+- assert sorted(x.text for x in result) == [
++ expected = [
+ 'MAKEDATE',
+ 'MAKETIME',
+ 'MAKE_SET',
+@@ -80,6 +81,11 @@ def test_function_name_completion(completer, complete_event):
+ 'MAX_USER_CONNECTIONS',
+ ]
+
++ if pygments_at_least("2.20"):
++ expected.extend([
++ 'MANUAL',
++ ])
++ assert sorted(x.text for x in result) == sorted(expected)
+
+ def test_column_name_completion(completer, complete_event):
+ text = "SELECT FROM users"
+diff --git a/test/test_smart_completion_public_schema_only.py b/test/test_smart_completion_public_schema_only.py
+index bf4e729..f46fb9b 100644
+--- a/test/test_smart_completion_public_schema_only.py
++++ b/test/test_smart_completion_public_schema_only.py
+@@ -7,6 +7,8 @@ from prompt_toolkit.completion import Completion
+ from prompt_toolkit.document import Document
+ import pytest
+
++from test.utils import pygments_at_least
++
+ import mycli.packages.special.main as special
+
+ metadata = {
+@@ -815,12 +817,11 @@ def test_backticked_column_completion_component(completer, complete_event):
+ Completion(text='`uncommitted`', start_position=-4),
+ ]
+
+-
+ def test_backticked_column_completion_two_character(completer, complete_event):
+ text = 'select `f'
+ position = len(text)
+ result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
+- assert result == [
++ expected = [
+ # todo it would be nicer if the column name "first_name" sorted to the top
+ Completion(text='`for`', start_position=-2),
+ Completion(text='`from`', start_position=-2),
+@@ -884,12 +885,27 @@ def test_backticked_column_completion_two_character(completer, complete_event):
+ Completion(text='`references`', start_position=-2),
+ ]
+
++ if pygments_at_least("2.20"):
++ expected.extend([
++ Completion(text='`file_format`', start_position=-2),
++ Completion(text='`file_name`', start_position=-2),
++ Completion(text='`file_pattern`', start_position=-2),
++ Completion(text='`file_prefix`', start_position=-2),
++ Completion(text='`files`', start_position=-2),
++ Completion(text='`from_vector`', start_position=-2),
++ ])
++
++ assert sorted(
++ (x.text, x.start_position) for x in result
++ ) == sorted(
++ (x.text, x.start_position) for x in expected
++ )
+
+ def test_backticked_column_completion_three_character(completer, complete_event):
+ text = 'select `fi'
+ position = len(text)
+ result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
+- assert result == [
++ expected = [
+ # todo it would be nicer if the column name "first_name" sorted to the top
+ Completion(text='`file`', start_position=-3),
+ Completion(text='`field`', start_position=-3),
+@@ -914,6 +930,20 @@ def test_backticked_column_completion_three_character(completer, complete_event)
+ Completion(text='`foreign key`', start_position=-3),
+ ]
+
++ if pygments_at_least("2.20"):
++ expected.extend([
++ Completion(text='`file_format`', start_position=-3),
++ Completion(text='`file_name`', start_position=-3),
++ Completion(text='`file_pattern`', start_position=-3),
++ Completion(text='`file_prefix`', start_position=-3),
++ Completion(text='`files`', start_position=-3),
++ ])
++
++ assert sorted(
++ (x.text, x.start_position) for x in result
++ ) == sorted(
++ (x.text, x.start_position) for x in expected
++ )
+
+ def test_backticked_column_completion_four_character(completer, complete_event):
+ text = 'select `fir'
+diff --git a/test/utils.py b/test/utils.py
+index 7d278f4..c6e95ad 100644
+--- a/test/utils.py
++++ b/test/utils.py
+@@ -9,6 +9,9 @@ import time
+ import pymysql
+ import pytest
+
++from packaging.version import Version
++import pygments
++
+ from mycli.constants import (
+ DEFAULT_CHARSET,
+ DEFAULT_HOST,
+@@ -29,13 +32,15 @@ SSH_HOST = os.getenv("PYTEST_SSH_HOST", None)
+ SSH_PORT = int(os.getenv("PYTEST_SSH_PORT", "22"))
+ TEMPFILE_PREFIX = 'mycli_test_suite_'
+
++PYGMENTS_VERSION = Version(pygments.__version__)
++def pygments_at_least(version: str) -> bool:
++ return PYGMENTS_VERSION >= Version(version)
+
+ def db_connection(dbname=None):
+ conn = pymysql.connect(user=USER, host=HOST, port=PORT, database=dbname, password=PASSWORD, charset=CHARACTER_SET, local_infile=False)
+ conn.autocommit = True
+ return conn
+
+-
+ try:
+ db_connection()
+ CAN_CONNECT_TO_DB = True
+--
+2.54.0
+
diff --git a/mycli.spec b/mycli.spec
index fd4b8db..8d886ae 100644
--- a/mycli.spec
+++ b/mycli.spec
@@ -4,7 +4,7 @@
Summary: Interactive CLI for MySQL Database with auto-completion and syntax highlighting
Name: mycli
Version: 1.66.0
-Release: 1%{?dist}
+Release: 2%{?dist}
# Automatically converted from old format: BSD - review is highly recommended.
License: LicenseRef-Callaway-BSD
URL: https://mycli.net
@@ -16,6 +16,7 @@ Patch: 0004-Revert-to-sqlglot-5.1.3.patch
Patch: 0005-Relax-various-reqs.patch
Patch: 0006-Work-with-older-cli-helpers.patch
Patch: 0007-Skip-test-failures-due-to-older-click.patch
+Patch: 0008-Adapt-test-suite-to-pygments-2.20.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: pyproject-rpm-macros
@@ -104,6 +105,9 @@ mysql -uroot --password=$PYTEST_PASSWORD --socket=$DATADIR/my.sock --port=3333 -
%{_bindir}/%{pypi_name}
%changelog
+* Thu May 14 2026 Terje Røsten <terjeros@gmail.com> - 1.66.0-2
+- Add patch to let test suite pass with pygments 2.20
+
* Mon Mar 23 2026 Terje Røsten <terjeros@gmail.com> - 1.66.0-1
- 1.66.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-15 9:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 9:28 [rpms/mycli] f44: Add patch to let test suite pass with pygments 2.20
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox