Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor deprecated unittest aliases for Python 3.11 compatibility. #51

Merged
merged 1 commit into from
Aug 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pathspec/tests/test_gitwildmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)