Refactor deprecated unittest aliases for Python 3.11 compatibility

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2025517
epel9
Miro Hrončok 3 years ago
parent a8f9adddcf
commit 204c8a9763

@ -0,0 +1,27 @@
From 46bad125f2d599a409704b6c1dcda47b709b4aec Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Sun, 10 Oct 2021 08:19:25 +0000
Subject: [PATCH] Refactor deprecated unittest aliases for Python 3.11
compatibility.
---
pathspec/tests/test_gitwildmatch.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pathspec/tests/test_gitwildmatch.py b/pathspec/tests/test_gitwildmatch.py
index 9868381..f9b4b66 100644
--- a/pathspec/tests/test_gitwildmatch.py
+++ b/pathspec/tests/test_gitwildmatch.py
@@ -543,6 +543,11 @@ def test_09_single_exclamation_mark_fail(self):
def _check_invalid_pattern(self, git_ignore_pattern):
expected_message_pattern = re.escape(repr(git_ignore_pattern))
- with self.assertRaisesRegexp(GitWildMatchPatternError, expected_message_pattern):
+ # assertRaisesRegexp was a deprecated alias removed in Python 3.11
+ if hasattr(self, 'assertRaisesRegex'):
+ assertRaisesRegex = self.assertRaisesRegex
+ else:
+ assertRaisesRegex = self.assertRaisesRegexp
+ with assertRaisesRegex(GitWildMatchPatternError, expected_message_pattern):
GitWildMatchPattern(git_ignore_pattern)

@ -7,6 +7,9 @@ License: MPL 2.0
URL: https://github.com/cpburnz/python-path-specification URL: https://github.com/cpburnz/python-path-specification
Source0: https://files.pythonhosted.org/packages/source/p/pathspec/pathspec-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/p/pathspec/pathspec-%{version}.tar.gz
# Refactor deprecated unittest aliases for Python 3.11 compatibility
Patch1: %{url}/pull/51.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
@ -27,7 +30,7 @@ is derived from Rsync's wildmatch. Git uses wildmatch for its gitignore files.
%prep %prep
%autosetup -n pathspec-%{version} %autosetup -p1 -n pathspec-%{version}
# Remove bundled egg-info # Remove bundled egg-info
rm -rf pathspec.egg-info rm -rf pathspec.egg-info

Loading…
Cancel
Save