mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-24 18:58:08 -07:00
dev-python/braintree: Enable py3.12
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( python3_{10..11} )
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
|
||||
inherit distutils-r1
|
||||
|
||||
@@ -34,6 +34,11 @@ DOCS=( README.md )
|
||||
|
||||
distutils_enable_tests unittest
|
||||
|
||||
PATCHES=(
|
||||
# https://github.com/braintree/braintree_python/pull/154
|
||||
"${FILESDIR}/${P}-py312.patch"
|
||||
)
|
||||
|
||||
python_test() {
|
||||
eunittest tests/unit
|
||||
}
|
||||
|
||||
81
dev-python/braintree/files/braintree-4.23.0-py312.patch
Normal file
81
dev-python/braintree/files/braintree-4.23.0-py312.patch
Normal file
@@ -0,0 +1,81 @@
|
||||
From 9fbdf874ef6a6874db5e98cb2c93ab9736810d4e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
||||
Date: Sun, 29 Oct 2023 11:18:56 +0100
|
||||
Subject: [PATCH] Fix test suite compatibility with Python 3.12
|
||||
|
||||
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
|
||||
---
|
||||
CHANGELOG.md | 3 +++
|
||||
tests/unit/test_client_token.py | 2 +-
|
||||
tests/unit/test_configuration.py | 6 +++---
|
||||
3 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||
index 56e4373..792ee9c 100644
|
||||
--- a/CHANGELOG.md
|
||||
+++ b/CHANGELOG.md
|
||||
@@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
+## 4.24.0
|
||||
+* Fix unittest compatibility with Python 3.12
|
||||
+
|
||||
## 4.23.0
|
||||
* Deprecate `evidenceSubmittable` in Dispute
|
||||
* Add missing `escape` calls in `generator` for:
|
||||
diff --git a/tests/unit/test_client_token.py b/tests/unit/test_client_token.py
|
||||
index 7216a6b..74eb8a2 100644
|
||||
--- a/tests/unit/test_client_token.py
|
||||
+++ b/tests/unit/test_client_token.py
|
||||
@@ -3,7 +3,7 @@ from tests.test_helper import *
|
||||
class TestClientToken(unittest.TestCase):
|
||||
def test_credit_card_options_require_customer_id(self):
|
||||
for option in ["verify_card", "make_default", "fail_on_duplicate_payment_method"]:
|
||||
- with self.assertRaisesRegexp(InvalidSignatureError, option):
|
||||
+ with self.assertRaisesRegex(InvalidSignatureError, option):
|
||||
ClientToken.generate({
|
||||
"options": {option: True}
|
||||
})
|
||||
diff --git a/tests/unit/test_configuration.py b/tests/unit/test_configuration.py
|
||||
index cf82831..5b24540 100644
|
||||
--- a/tests/unit/test_configuration.py
|
||||
+++ b/tests/unit/test_configuration.py
|
||||
@@ -1,13 +1,13 @@
|
||||
from tests.test_helper import *
|
||||
import braintree
|
||||
import os
|
||||
-import imp
|
||||
+import importlib
|
||||
|
||||
class TestConfiguration(unittest.TestCase):
|
||||
def test_works_with_unconfigured_configuration(self):
|
||||
try:
|
||||
# reset class level attributes on Configuration set in test helper
|
||||
- imp.reload(braintree.configuration)
|
||||
+ importlib.reload(braintree.configuration)
|
||||
config = Configuration(
|
||||
environment=braintree.Environment.Sandbox,
|
||||
merchant_id='my_merchant_id',
|
||||
@@ -21,7 +21,7 @@ class TestConfiguration(unittest.TestCase):
|
||||
finally:
|
||||
# repopulate class level attributes on Configuration
|
||||
import tests.test_helper
|
||||
- imp.reload(tests.test_helper)
|
||||
+ importlib.reload(tests.test_helper)
|
||||
|
||||
def test_base_merchant_path_for_development(self):
|
||||
self.assertEqual("/merchants/integration_merchant_id", Configuration.instantiate().base_merchant_path())
|
||||
--
|
||||
2.42.0
|
||||
|
||||
Reference in New Issue
Block a user