diff --git a/51.patch b/51.patch new file mode 100644 index 0000000..eb9699f --- /dev/null +++ b/51.patch @@ -0,0 +1,27 @@ +From 46bad125f2d599a409704b6c1dcda47b709b4aec Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan +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) + diff --git a/python-pathspec.spec b/python-pathspec.spec index 2e95983..73d3f2c 100644 --- a/python-pathspec.spec +++ b/python-pathspec.spec @@ -7,6 +7,9 @@ License: MPL 2.0 URL: https://github.com/cpburnz/python-path-specification 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 BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -27,7 +30,7 @@ is derived from Rsync's wildmatch. Git uses wildmatch for its gitignore files. %prep -%autosetup -n pathspec-%{version} +%autosetup -p1 -n pathspec-%{version} # Remove bundled egg-info rm -rf pathspec.egg-info