Accepting request 1235856 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/1235856 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest?expand=0&rev=88
This commit is contained in:
commit
3c55f3803f
102
pygments.patch
Normal file
102
pygments.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From 7972182f2686dd8e1afa2f3e088af501d487eb28 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Bruhin <me@the-compiler.org>
|
||||
Date: Tue, 7 Jan 2025 11:25:55 +0100
|
||||
Subject: [PATCH] Fix selftests with Pygments >= 2.19.0
|
||||
|
||||
With Pygments 2.19, the Python lexer now emits
|
||||
Text.Whitespace (rather than Text) tokens after "def",
|
||||
which get highlighted as "bright black".
|
||||
|
||||
See https://github.com/pygments/pygments/issues/1905
|
||||
Fixes #13112
|
||||
---
|
||||
changelog/13112.contrib.rst | 1 +
|
||||
testing/conftest.py | 6 ++++++
|
||||
testing/test_terminal.py | 10 +++++-----
|
||||
3 files changed, 12 insertions(+), 5 deletions(-)
|
||||
create mode 100644 changelog/13112.contrib.rst
|
||||
|
||||
Index: pytest-8.3.4/changelog/13112.contrib.rst
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ pytest-8.3.4/changelog/13112.contrib.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Fixed selftest failures in ``test_terminal.py`` with Pygments >= 2.19.0
|
||||
Index: pytest-8.3.4/testing/conftest.py
|
||||
===================================================================
|
||||
--- pytest-8.3.4.orig/testing/conftest.py
|
||||
+++ pytest-8.3.4/testing/conftest.py
|
||||
@@ -6,6 +6,8 @@ import re
|
||||
import sys
|
||||
from typing import Generator
|
||||
|
||||
+import pygments
|
||||
+
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from _pytest.pytester import Pytester
|
||||
import pytest
|
||||
@@ -168,6 +170,9 @@ def color_mapping():
|
||||
|
||||
Used by tests which check the actual colors output by pytest.
|
||||
"""
|
||||
+ # https://github.com/pygments/pygments/commit/d24e272894a56a98b1b718d9ac5fabc20124882a
|
||||
+ pygments_version = tuple(int(part) for part in pygments.__version__.split(".")[:2])
|
||||
+ pygments_has_kwspace_hl = pygments_version >= (2, 19)
|
||||
|
||||
class ColorMapping:
|
||||
COLORS = {
|
||||
@@ -180,6 +185,7 @@ def color_mapping():
|
||||
"bold": "\x1b[1m",
|
||||
"reset": "\x1b[0m",
|
||||
"kw": "\x1b[94m",
|
||||
+ "kwspace": "\x1b[90m \x1b[39;49;00m" if pygments_has_kwspace_hl else " ",
|
||||
"hl-reset": "\x1b[39;49;00m",
|
||||
"function": "\x1b[92m",
|
||||
"number": "\x1b[94m",
|
||||
Index: pytest-8.3.4/testing/test_terminal.py
|
||||
===================================================================
|
||||
--- pytest-8.3.4.orig/testing/test_terminal.py
|
||||
+++ pytest-8.3.4/testing/test_terminal.py
|
||||
@@ -1299,13 +1299,13 @@ def test_color_yes(pytester: Pytester, c
|
||||
"=*= FAILURES =*=",
|
||||
"{red}{bold}_*_ test_this _*_{reset}",
|
||||
"",
|
||||
- " {reset}{kw}def{hl-reset} {function}test_this{hl-reset}():{endline}",
|
||||
+ " {reset}{kw}def{hl-reset}{kwspace}{function}test_this{hl-reset}():{endline}",
|
||||
"> fail(){endline}",
|
||||
"",
|
||||
"{bold}{red}test_color_yes.py{reset}:5: ",
|
||||
"_ _ * _ _*",
|
||||
"",
|
||||
- " {reset}{kw}def{hl-reset} {function}fail{hl-reset}():{endline}",
|
||||
+ " {reset}{kw}def{hl-reset}{kwspace}{function}fail{hl-reset}():{endline}",
|
||||
"> {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 0{reset}",
|
||||
"",
|
||||
@@ -2585,7 +2585,7 @@ class TestCodeHighlight:
|
||||
result.stdout.fnmatch_lines(
|
||||
color_mapping.format_for_fnmatch(
|
||||
[
|
||||
- " {reset}{kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
+ " {reset}{kw}def{hl-reset}{kwspace}{function}test_foo{hl-reset}():{endline}",
|
||||
"> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 1 == 10{reset}",
|
||||
]
|
||||
@@ -2607,7 +2607,7 @@ class TestCodeHighlight:
|
||||
result.stdout.fnmatch_lines(
|
||||
color_mapping.format_for_fnmatch(
|
||||
[
|
||||
- " {reset}{kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
+ " {reset}{kw}def{hl-reset}{kwspace}{function}test_foo{hl-reset}():{endline}",
|
||||
" {print}print{hl-reset}({str}'''{hl-reset}{str}{hl-reset}",
|
||||
"> {str} {hl-reset}{str}'''{hl-reset}); {kw}assert{hl-reset} {number}0{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 0{reset}",
|
||||
@@ -2630,7 +2630,7 @@ class TestCodeHighlight:
|
||||
result.stdout.fnmatch_lines(
|
||||
color_mapping.format_for_fnmatch(
|
||||
[
|
||||
- " {reset}{kw}def{hl-reset} {function}test_foo{hl-reset}():{endline}",
|
||||
+ " {reset}{kw}def{hl-reset}{kwspace}{function}test_foo{hl-reset}():{endline}",
|
||||
"> {kw}assert{hl-reset} {number}1{hl-reset} == {number}10{hl-reset}{endline}",
|
||||
"{bold}{red}E assert 1 == 10{reset}",
|
||||
]
|
BIN
pytest-8.3.3.tar.gz
(Stored with Git LFS)
BIN
pytest-8.3.3.tar.gz
(Stored with Git LFS)
Binary file not shown.
3
pytest-8.3.4.tar.gz
Normal file
3
pytest-8.3.4.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761
|
||||
size 1445919
|
@ -1,3 +1,35 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 7 14:12:55 UTC 2025 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
- Add upstream pygments.patch to fix compatibility with new Pygments
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 5 18:03:42 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 8.3.4:
|
||||
* #12592: Fixed :class:`KeyError` crash when using --import-
|
||||
mode=importlib in a directory layout where a directory
|
||||
contains a child directory with the same name.
|
||||
* #12818: Assertion rewriting now preserves the source ranges
|
||||
of the original instructions, making it play well with tools
|
||||
that deal with the AST, like executing.
|
||||
* #12849: ANSI escape codes for colored output now handled
|
||||
correctly in :func:`pytest.fail` with pytrace=False.
|
||||
* #9353: :func:`pytest.approx` now uses strict equality when
|
||||
given booleans.
|
||||
* #10558: Fix ambiguous docstring of
|
||||
:func:`pytest.Config.getoption`.
|
||||
* #10829: Improve documentation on the current handling of the
|
||||
--basetemp option and its lack of retention functionality
|
||||
(:ref:`temporary directory location and retention`).
|
||||
* #12866: Improved cross-references concerning the
|
||||
:fixture:`recwarn` fixture.
|
||||
* #12966: Clarify :ref:`filterwarnings` docs on filter
|
||||
precedence/order when using multiple
|
||||
:ref:`@pytest.mark.filterwarnings <pytest.mark.filterwarnings
|
||||
ref>` marks.
|
||||
* #12497: Fixed two failing pdb-related tests on Python 3.13.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 24 07:24:14 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-pytest
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -33,12 +33,15 @@
|
||||
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-pytest%{psuffix}
|
||||
Version: 8.3.3
|
||||
Version: 8.3.4
|
||||
Release: 0
|
||||
Summary: Simple powerful testing with Python
|
||||
License: MIT
|
||||
URL: https://github.com/pytest-dev/pytest
|
||||
Source: https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM https://github.com/pytest-dev/pytest/pull/13113 Fix selftests with Pygments >= 2.19.0
|
||||
# fresh from the oven at the time of patching, may need refresh
|
||||
Patch: pygments.patch
|
||||
BuildRequires: %{python_module base >= 3.8}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools_scm >= 6}
|
||||
|
Loading…
x
Reference in New Issue
Block a user