#1 Fix tests on Python 3.11 (fix RHBZ#2050083)
Merged 3 months ago by churchyard. Opened 3 months ago by music.
rpms/ music/python-ansiwrap python311  into  rawhide

file added
+25
@@ -0,0 +1,25 @@ 

+ From b7f0149d6063c095da5ccb74afc6262682a9ff92 Mon Sep 17 00:00:00 2001

+ From: "Benjamin A. Beasley" <code@musicinmybrain.net>

+ Date: Mon, 20 Jun 2022 09:27:40 -0400

+ Subject: [PATCH] Fix tests on Python 3.11 (fix #18)

+ 

+ random.sample() population must be a sequence

+ ---

+  test/test_ansiwrap.py | 4 ++--

+  1 file changed, 2 insertions(+), 2 deletions(-)

+ 

+ diff --git a/test/test_ansiwrap.py b/test/test_ansiwrap.py

+ index 13e7149..da97f0e 100644

+ --- a/test/test_ansiwrap.py

+ +++ b/test/test_ansiwrap.py

+ @@ -20,8 +20,8 @@

+  

+  # as an alternative to testing all lengths at all times, which is slow,

+  # choose a few other lengths at random

+ -other_lengths = (random.sample(set(range(20, 120)).difference(LINE_LENGTHS), 2) +

+ -                 random.sample(set(range(120, 400)).difference(LINE_LENGTHS), 1))

+ +other_lengths = (random.sample(sorted(set(range(20, 120)).difference(LINE_LENGTHS)), 2) +

+ +                 random.sample(sorted(set(range(120, 400)).difference(LINE_LENGTHS)), 1))

+  LINE_LENGTHS.extend(other_lengths)

+  

+  

file modified
+7 -2
@@ -2,7 +2,7 @@ 

  

  Name:           python-%{pypi_name}

  Version:        0.8.4

- Release:        7%{?dist}

+ Release:        8%{?dist}

  Summary:        Text wrapper with ANSI colors and styles support

  

  License:        ASL 2.0
@@ -10,6 +10,8 @@ 

  Source0:        %{pypi_source %{pypi_name} %{version} zip}

  BuildArch:      noarch

  

+ Patch:          %{url}/pull/19.patch

+ 

  %description

  ansiwrap wraps text, like the standard textwrap module. But it also correctly

  wraps text that contains ANSI control sequences that colorize or style text.
@@ -38,7 +40,7 @@ 

  and display style, they have no logical length.

  

  %prep

- %autosetup -n %{pypi_name}-%{version}

+ %autosetup -n %{pypi_name}-%{version} -p1

  rm -rf %{pypi_name}.egg-info

  

  %build
@@ -57,6 +59,9 @@ 

  %{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info

  

  %changelog

+ * Mon Jun 20 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.8.4-8

+ - Fix tests on Python 3.11 (fix RHBZ#2050083)

+ 

  * Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.8.4-7

  - Rebuilt for Python 3.11

  

Metadata