Skip to content

Fix test suite compatibility with Python 3.12#154

Merged
debrado merged 1 commit intobraintree:masterfrom
mgorny:py312
Nov 6, 2023
Merged

Fix test suite compatibility with Python 3.12#154
debrado merged 1 commit intobraintree:masterfrom
mgorny:py312

Conversation

@mgorny
Copy link
Contributor

@mgorny mgorny commented Oct 29, 2023

Summary

Replace the deprecated unittest.TestCase.assertRaisesRegexp() method with assertRaisesRegex(). The former is no longer present in Python 3.12, while the latter is available since Python 3.2.

Replace the deprecated imp.reload() function with importlib.reload(). The former module is no longer present in Python 3.12, while importlib.reload() is available since Python 3.4.

With these changes, unit tests pass with Python 3.12.0.

Fixes #153

Checklist

  • Added changelog entry
  • Ran unit tests (python3 -m unittest discover tests/unit)
  • I understand that unless this is a Draft PR or has a DO NOT MERGE label, this PR is considered to be in a deploy ready state and can be deployed if merged to main

Replace the deprecated `unittest.TestCase.assertRaisesRegexp()` method
with `assertRaisesRegex()`.  The former is no longer present in Python
3.12, while the latter is available since Python 3.2.

Replace the deprecated `imp.reload()` function with
`importlib.reload()`.  The former module is no longer present
in Python 3.12, while `importlib.reload()` is available since
Python 3.4.

With these changes, unit tests pass with Python 3.12.0.

Fixes braintree#153
@mgorny mgorny requested a review from a team as a code owner October 29, 2023 10:24
@hollabaq86
Copy link

👋 @mgorny Thanks for the PR! We'll take a look and provide feedback. For internal tracking, issue 26930

@debrado debrado merged commit 9fbdf87 into braintree:master Nov 6, 2023
debrado added a commit that referenced this pull request Nov 6, 2023
Fix test suite compatibility with Python 3.12 #154
@mgorny mgorny deleted the py312 branch November 6, 2023 20:18
@mgorny
Copy link
Contributor Author

mgorny commented Nov 6, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unittest failures on Python 3.12

3 participants