diff --git a/payments/mercadopago/test_mercadopago.py b/payments/mercadopago/test_mercadopago.py index 7a0527ec8..a5111dc61 100644 --- a/payments/mercadopago/test_mercadopago.py +++ b/payments/mercadopago/test_mercadopago.py @@ -202,14 +202,17 @@ def test_approved_payment_notification(rf, mp_provider: MercadoPagoProvider): "status": 200, } - with patch( - "mercadopago.resources.payment.Payment.get", - spec=True, - return_value=payment_info_response, - ) as payment_info, patch( - "payments.mercadopago.redirect", - spec=True, - ) as redirect: + with ( + patch( + "mercadopago.resources.payment.Payment.get", + spec=True, + return_value=payment_info_response, + ) as payment_info, + patch( + "payments.mercadopago.redirect", + spec=True, + ) as redirect, + ): rv = mp_provider.process_data(payment, request) assert payment_info.call_count == 1 @@ -232,13 +235,16 @@ def test_create_preference_failure(mp_provider: MercadoPagoProvider): payment = Payment() - with patch( - "mercadopago.resources.preference.Preference.create", - spec=True, - return_value=preference_info, - ), pytest.raises( - PaymentError, - match="Failed to create MercadoPago preference.", + with ( + patch( + "mercadopago.resources.preference.Preference.create", + spec=True, + return_value=preference_info, + ), + pytest.raises( + PaymentError, + match="Failed to create MercadoPago preference.", + ), ): mp_provider.create_preference(payment) @@ -266,13 +272,16 @@ def test_process_failed_collection(mp_provider: MercadoPagoProvider): } payment = Payment() - with patch( - "mercadopago.resources.payment.Payment.get", - spec=True, - return_value=payment_info, - ), pytest.raises( - PaymentError, - match="MercadoPago sent invalid payment data.", + with ( + patch( + "mercadopago.resources.payment.Payment.get", + spec=True, + return_value=payment_info, + ), + pytest.raises( + PaymentError, + match="MercadoPago sent invalid payment data.", + ), ): mp_provider.process_collection(payment, "12") @@ -331,12 +340,13 @@ def test_get_preference_internal_error(mp_provider: MercadoPagoProvider): payment = Payment() payment.transaction_id = "ABJ122" - with patch( - "mercadopago.resources.preference.Preference.get", - spec=True, - return_value=mocked_response, - ) as get_preference, pytest.raises( - PaymentError, match="Failed to retrieve MercadoPago preference." + with ( + patch( + "mercadopago.resources.preference.Preference.get", + spec=True, + return_value=mocked_response, + ) as get_preference, + pytest.raises(PaymentError, match="Failed to retrieve MercadoPago preference."), ): mp_provider.get_preference(payment) @@ -365,11 +375,14 @@ def test_get_form_for_existing_preference( payment = Payment() payment.transaction_id = "ABJ122" - with patch( - "mercadopago.resources.preference.Preference.get", - spec=True, - return_value=mocked_response, - ) as get_preference, pytest.raises(RedirectNeeded) as exc_info: + with ( + patch( + "mercadopago.resources.preference.Preference.get", + spec=True, + return_value=mocked_response, + ) as get_preference, + pytest.raises(RedirectNeeded) as exc_info, + ): mp_provider.get_form(payment) assert get_preference.call_count == 1 @@ -387,11 +400,14 @@ def test_get_form_for_inexistent_preference(mp_provider: MercadoPagoProvider): } payment = Payment() - with patch( - "mercadopago.resources.preference.Preference.create", - spec=True, - return_value=mocked_response, - ) as get_preference, pytest.raises(RedirectNeeded) as exc_info: + with ( + patch( + "mercadopago.resources.preference.Preference.create", + spec=True, + return_value=mocked_response, + ) as get_preference, + pytest.raises(RedirectNeeded) as exc_info, + ): mp_provider.get_form(payment) assert get_preference.call_count == 1 diff --git a/payments/models.py b/payments/models.py index fe5203aee..303492033 100644 --- a/payments/models.py +++ b/payments/models.py @@ -2,7 +2,7 @@ import json import logging -from typing import Iterable +from collections.abc import Iterable from uuid import uuid4 from django.db import models diff --git a/pyproject.toml b/pyproject.toml index 772a0b5c4..4e5e94419 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,13 +8,11 @@ authors = [ ] description = "Universal payment handling for Django" readme = "README.rst" -requires-python = ">=3.7" +requires-python = ">=3.9" keywords = ["payments"] license = {text = "BSD"} classifiers = [ "Environment :: Web Environment", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.1", "Framework :: Django :: 4.2", "Framework :: Django :: 5.0", "Framework :: Django :: 5.1", @@ -22,16 +20,16 @@ classifiers = [ "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Framework :: Django", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules", ] dependencies = [ - "Django>=3.2", + "Django>=4.2", "requests>=1.2.0", "django-phonenumber-field[phonenumberslite]>=5.0.0", ] @@ -89,7 +87,7 @@ DJANGO_SETTINGS_MODULE = "test_settings" pythonpath = "." [tool.ruff] -target-version = "py38" +target-version = "py39" [tool.ruff.lint] select = [ diff --git a/tox.ini b/tox.ini index 4ade0527b..23e4611ea 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [tox] envlist = - py{38,39}-dj32 - py{38,39,310,311}-dj{41,42} + py{39,310,311}-dj{41,42} py{311,312}-dj{50,51} py{310,311,312}-djmain skip_missing_interpreters = true @@ -13,8 +12,6 @@ ignore_outcome = ignore_errors = djmain: True deps= - dj32: Django>=3.2,<3.3 - dj41: Django>=4.1,<4.2 dj42: Django>=4.2,<5.0 dj50: Django>=5.0,<5.1 dj51: Django>=5.1,<5.2 @@ -33,7 +30,6 @@ commands= [gh-actions] python = - 3.8: py38 3.9: py39 3.10: py310 3.11: py311 @@ -48,8 +44,6 @@ commands = mypy . [gh-actions:env] DJANGO = - 3.2: dj32 - 4.1: dj41 4.2: dj42 5.0: dj50 5.1: dj51