diff --git a/ecommerce/api_test.py b/ecommerce/api_test.py index f0dcfe992..f8096feae 100644 --- a/ecommerce/api_test.py +++ b/ecommerce/api_test.py @@ -110,7 +110,6 @@ FAKE = faker.Factory.create() pytestmark = pytest.mark.django_db -lazy = pytest.lazy_fixture CYBERSOURCE_ACCESS_KEY = "access" CYBERSOURCE_PROFILE_ID = "profile" diff --git a/ecommerce/mail_api_test.py b/ecommerce/mail_api_test.py index 65e0baae5..2f2acc5ed 100644 --- a/ecommerce/mail_api_test.py +++ b/ecommerce/mail_api_test.py @@ -48,8 +48,6 @@ from mitxpro.utils import format_price from users.factories import UserFactory -lazy = pytest.lazy_fixture - pytestmark = pytest.mark.django_db diff --git a/ecommerce/views_test.py b/ecommerce/views_test.py index 6d5c98f34..6654e19af 100644 --- a/ecommerce/views_test.py +++ b/ecommerce/views_test.py @@ -9,6 +9,7 @@ import pytest from django.db.models import Count, Q from django.urls import reverse +from pytest_lazy_fixtures import lf as lazy from rest_framework import status from rest_framework.renderers import JSONRenderer from rest_framework.test import APIClient @@ -70,7 +71,6 @@ CYBERSOURCE_SECURITY_KEY = "security" FAKE = faker.Factory.create() -lazy = pytest.lazy_fixture pytestmark = pytest.mark.django_db diff --git a/mail/api_test.py b/mail/api_test.py index d46573e01..46632e197 100644 --- a/mail/api_test.py +++ b/mail/api_test.py @@ -3,6 +3,7 @@ from email.utils import formataddr import pytest +from pytest_lazy_fixtures import lf as lazy from mail.api import ( EmailMetadata, @@ -20,7 +21,6 @@ from users.factories import UserFactory pytestmark = [pytest.mark.django_db, pytest.mark.usefixtures("email_settings")] -lazy = pytest.lazy_fixture @pytest.fixture diff --git a/maxmind/api_test.py b/maxmind/api_test.py index 4e722f6ce..5c149eb06 100644 --- a/maxmind/api_test.py +++ b/maxmind/api_test.py @@ -53,4 +53,4 @@ def test_ipv4_lookup(v4, in_block): result = ip_to_country_code(str(test_address)) - return result is None and not in_block + assert (result is not None and in_block) or result is None diff --git a/poetry.lock b/poetry.lock index 0a29b5cc4..2902327a9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3064,23 +3064,23 @@ files = [ [[package]] name = "pytest" -version = "7.4.4" +version = "8.3.2" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, - {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, ] [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<2.0" +pluggy = ">=1.5,<2" [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "pytest-cov" @@ -3136,18 +3136,18 @@ pytest = ">=7.4.3" test = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "pytest-mock (>=3.12)"] [[package]] -name = "pytest-lazy-fixture" -version = "0.6.3" -description = "It helps to use fixtures in pytest.mark.parametrize" +name = "pytest-lazy-fixtures" +version = "1.1.1" +description = "Allows you to use fixtures in @pytest.mark.parametrize." optional = false -python-versions = "*" +python-versions = "<4.0,>=3.8" files = [ - {file = "pytest-lazy-fixture-0.6.3.tar.gz", hash = "sha256:0e7d0c7f74ba33e6e80905e9bfd81f9d15ef9a790de97993e34213deb5ad10ac"}, - {file = "pytest_lazy_fixture-0.6.3-py3-none-any.whl", hash = "sha256:e0b379f38299ff27a653f03eaa69b08a6fd4484e46fd1c9907d984b9f9daeda6"}, + {file = "pytest_lazy_fixtures-1.1.1-py3-none-any.whl", hash = "sha256:a4b396a361faf56c6305535fd0175ce82902ca7cf668c4d812a25ed2bcde8183"}, + {file = "pytest_lazy_fixtures-1.1.1.tar.gz", hash = "sha256:0c561f0d29eea5b55cf29b9264a3241999ffdb74c6b6e8c4ccc0bd2c934d01ed"}, ] [package.dependencies] -pytest = ">=3.2.5" +pytest = ">=7" [[package]] name = "pytest-mock" @@ -4144,4 +4144,4 @@ xmlsec = ["xmlsec (>=0.6.1)"] [metadata] lock-version = "2.0" python-versions = "3.12.5" -content-hash = "970fba2406b0c1fbdee5a6e47063187987536e3a18acafe6893572906426e140" +content-hash = "98d457c43063acb1b2978c25185e0a39a3756b726bc82823eeba24593c74d45c" diff --git a/pyproject.toml b/pyproject.toml index 5a0b45171..a7565e3d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,11 +72,11 @@ hypothesis = "4.24.6" ipdb = "*" nplusone = ">=0.8.1" pdbpp = "*" -pytest = "^7.4.4" +pytest = "^8.0.0" pytest-cov = ">=2.6.1" pytest-django = "*" pytest-env = "*" -pytest-lazy-fixture = "0.6.3" +pytest-lazy-fixtures = "*" pytest-mock = "*" responses = "*" ruff = "^0.6.0" diff --git a/sheets/views_test.py b/sheets/views_test.py index 1c7b05b39..494a676bd 100644 --- a/sheets/views_test.py +++ b/sheets/views_test.py @@ -3,6 +3,7 @@ import pytest from django.test.client import Client, RequestFactory from django.urls import reverse +from pytest_lazy_fixtures import lf as lazy from rest_framework import status from mitxpro.test_utils import set_request_session @@ -10,8 +11,6 @@ from sheets.models import GoogleApiAuth from sheets.views import complete_google_auth -lazy = pytest.lazy_fixture - @pytest.fixture def google_api_auth(user):