From 18e226fefdfb1209c8c9b7115c1961044864cb46 Mon Sep 17 00:00:00 2001 From: jefer94 Date: Thu, 29 Aug 2024 16:00:08 -0500 Subject: [PATCH] changes in capyc directories --- .../management/commands/tests_supervisor.py | 4 ++-- ...ests_supervise_all_consumption_sessions.py | 4 ++-- .../tasks/tests_refund_mentoring_session.py | 2 +- ...ests_me_service_slug_consumptionsession.py | 2 +- .../circuitbreaker}/__init__.py | 0 .../circuitbreaker}/fixtures/__init__.py | 0 .../fixtures/dont_close_the_circuit.py | 0 .../{core/pytest => pytest/core}/__init__.py | 0 .../core}/fixtures/__init__.py | 0 .../core}/fixtures/clean_environment.py | 0 .../pytest => pytest/core}/fixtures/fake.py | 0 .../pytest => pytest/core}/fixtures/format.py | 0 .../pytest => pytest/core}/fixtures/image.py | 0 .../core}/fixtures/no_http_requests.py | 0 .../pytest => pytest/core}/fixtures/random.py | 0 .../pytest => pytest/core}/fixtures/seed.py | 0 .../pytest => pytest/django}/__init__.py | 2 +- .../django}/fixtures/__init__.py | 0 .../django}/fixtures/database.py | 0 .../django}/fixtures/queryset.py | 0 .../django}/fixtures/signals.py | 0 .../pytest => pytest/newrelic}/__init__.py | 0 .../newrelic}/fixtures/__init__.py | 0 .../newrelic}/fixtures/disable_new_relic.py | 0 .../fixtures/disable_newrelic_prints.py | 0 capyc/pytest/rest_framework/__init__.py | 5 +++++ .../rest_framework/fixtures/__init__.py | 3 +++ .../pytest/rest_framework/fixtures/client.py | 19 +++++++++++++++++++ capyc/rest_framework/pytest/__init__.py | 2 +- conftest.py | 14 +++++++------- 30 files changed, 42 insertions(+), 15 deletions(-) rename capyc/{circuitbreaker/pytest => pytest/circuitbreaker}/__init__.py (100%) rename capyc/{circuitbreaker/pytest => pytest/circuitbreaker}/fixtures/__init__.py (100%) rename capyc/{circuitbreaker/pytest => pytest/circuitbreaker}/fixtures/dont_close_the_circuit.py (100%) rename capyc/{core/pytest => pytest/core}/__init__.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/__init__.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/clean_environment.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/fake.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/format.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/image.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/no_http_requests.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/random.py (100%) rename capyc/{core/pytest => pytest/core}/fixtures/seed.py (100%) rename capyc/{django/pytest => pytest/django}/__init__.py (68%) rename capyc/{django/pytest => pytest/django}/fixtures/__init__.py (100%) rename capyc/{django/pytest => pytest/django}/fixtures/database.py (100%) rename capyc/{django/pytest => pytest/django}/fixtures/queryset.py (100%) rename capyc/{django/pytest => pytest/django}/fixtures/signals.py (100%) rename capyc/{newrelic/pytest => pytest/newrelic}/__init__.py (100%) rename capyc/{newrelic/pytest => pytest/newrelic}/fixtures/__init__.py (100%) rename capyc/{newrelic/pytest => pytest/newrelic}/fixtures/disable_new_relic.py (100%) rename capyc/{newrelic/pytest => pytest/newrelic}/fixtures/disable_newrelic_prints.py (100%) create mode 100644 capyc/pytest/rest_framework/__init__.py create mode 100644 capyc/pytest/rest_framework/fixtures/__init__.py create mode 100644 capyc/pytest/rest_framework/fixtures/client.py diff --git a/breathecode/monitoring/tests/management/commands/tests_supervisor.py b/breathecode/monitoring/tests/management/commands/tests_supervisor.py index 42f38c93d..ac2edf695 100644 --- a/breathecode/monitoring/tests/management/commands/tests_supervisor.py +++ b/breathecode/monitoring/tests/management/commands/tests_supervisor.py @@ -4,8 +4,8 @@ import pytest from asgiref.sync import sync_to_async -import capyc.core.pytest.fixtures as cfx -import capyc.django.pytest.fixtures as dfx +import capyc.pytest.core.fixtures as cfx +import capyc.pytest.django.fixtures as dfx from breathecode.monitoring.models import Supervisor as SupervisorModel from breathecode.monitoring.models import SupervisorIssue from breathecode.tests.mixins.breathecode_mixin.breathecode import Breathecode diff --git a/breathecode/payments/tests/supervisors/tests_supervise_all_consumption_sessions.py b/breathecode/payments/tests/supervisors/tests_supervise_all_consumption_sessions.py index 97c248783..55216ef6f 100644 --- a/breathecode/payments/tests/supervisors/tests_supervise_all_consumption_sessions.py +++ b/breathecode/payments/tests/supervisors/tests_supervise_all_consumption_sessions.py @@ -5,8 +5,8 @@ import pytest from asgiref.sync import sync_to_async -import capyc.core.pytest.fixtures as cfx -import capyc.django.pytest.fixtures as dfx +import capyc.pytest.core.fixtures as cfx +import capyc.pytest.django.fixtures as dfx from breathecode.monitoring.models import Supervisor as SupervisorModel from breathecode.monitoring.models import SupervisorIssue from breathecode.payments.supervisors import supervise_all_consumption_sessions diff --git a/breathecode/payments/tests/tasks/tests_refund_mentoring_session.py b/breathecode/payments/tests/tasks/tests_refund_mentoring_session.py index a6659810a..1a3cce872 100644 --- a/breathecode/payments/tests/tasks/tests_refund_mentoring_session.py +++ b/breathecode/payments/tests/tasks/tests_refund_mentoring_session.py @@ -10,7 +10,7 @@ from django.utils import timezone from breathecode.tests.mixins.breathecode_mixin.breathecode import Breathecode -from capyc.django.pytest.fixtures import QuerySet +from capyc.pytest.django.fixtures import QuerySet from ...tasks import refund_mentoring_session diff --git a/breathecode/payments/tests/urls/tests_me_service_slug_consumptionsession.py b/breathecode/payments/tests/urls/tests_me_service_slug_consumptionsession.py index 9c34500d4..c6b8f4e65 100644 --- a/breathecode/payments/tests/urls/tests_me_service_slug_consumptionsession.py +++ b/breathecode/payments/tests/urls/tests_me_service_slug_consumptionsession.py @@ -6,7 +6,7 @@ from rest_framework import status from breathecode.tests.mixins.breathecode_mixin.breathecode import Breathecode -from capyc.rest_framework.pytest import fixtures as rfx +from capyc.pytest.rest_framework import fixtures as rfx @pytest.fixture(autouse=True) diff --git a/capyc/circuitbreaker/pytest/__init__.py b/capyc/pytest/circuitbreaker/__init__.py similarity index 100% rename from capyc/circuitbreaker/pytest/__init__.py rename to capyc/pytest/circuitbreaker/__init__.py diff --git a/capyc/circuitbreaker/pytest/fixtures/__init__.py b/capyc/pytest/circuitbreaker/fixtures/__init__.py similarity index 100% rename from capyc/circuitbreaker/pytest/fixtures/__init__.py rename to capyc/pytest/circuitbreaker/fixtures/__init__.py diff --git a/capyc/circuitbreaker/pytest/fixtures/dont_close_the_circuit.py b/capyc/pytest/circuitbreaker/fixtures/dont_close_the_circuit.py similarity index 100% rename from capyc/circuitbreaker/pytest/fixtures/dont_close_the_circuit.py rename to capyc/pytest/circuitbreaker/fixtures/dont_close_the_circuit.py diff --git a/capyc/core/pytest/__init__.py b/capyc/pytest/core/__init__.py similarity index 100% rename from capyc/core/pytest/__init__.py rename to capyc/pytest/core/__init__.py diff --git a/capyc/core/pytest/fixtures/__init__.py b/capyc/pytest/core/fixtures/__init__.py similarity index 100% rename from capyc/core/pytest/fixtures/__init__.py rename to capyc/pytest/core/fixtures/__init__.py diff --git a/capyc/core/pytest/fixtures/clean_environment.py b/capyc/pytest/core/fixtures/clean_environment.py similarity index 100% rename from capyc/core/pytest/fixtures/clean_environment.py rename to capyc/pytest/core/fixtures/clean_environment.py diff --git a/capyc/core/pytest/fixtures/fake.py b/capyc/pytest/core/fixtures/fake.py similarity index 100% rename from capyc/core/pytest/fixtures/fake.py rename to capyc/pytest/core/fixtures/fake.py diff --git a/capyc/core/pytest/fixtures/format.py b/capyc/pytest/core/fixtures/format.py similarity index 100% rename from capyc/core/pytest/fixtures/format.py rename to capyc/pytest/core/fixtures/format.py diff --git a/capyc/core/pytest/fixtures/image.py b/capyc/pytest/core/fixtures/image.py similarity index 100% rename from capyc/core/pytest/fixtures/image.py rename to capyc/pytest/core/fixtures/image.py diff --git a/capyc/core/pytest/fixtures/no_http_requests.py b/capyc/pytest/core/fixtures/no_http_requests.py similarity index 100% rename from capyc/core/pytest/fixtures/no_http_requests.py rename to capyc/pytest/core/fixtures/no_http_requests.py diff --git a/capyc/core/pytest/fixtures/random.py b/capyc/pytest/core/fixtures/random.py similarity index 100% rename from capyc/core/pytest/fixtures/random.py rename to capyc/pytest/core/fixtures/random.py diff --git a/capyc/core/pytest/fixtures/seed.py b/capyc/pytest/core/fixtures/seed.py similarity index 100% rename from capyc/core/pytest/fixtures/seed.py rename to capyc/pytest/core/fixtures/seed.py diff --git a/capyc/django/pytest/__init__.py b/capyc/pytest/django/__init__.py similarity index 68% rename from capyc/django/pytest/__init__.py rename to capyc/pytest/django/__init__.py index 9e9518498..712cc4401 100644 --- a/capyc/django/pytest/__init__.py +++ b/capyc/pytest/django/__init__.py @@ -1,5 +1,5 @@ """Centralized Breathecode fixtures for all our libraries.""" -from capyc.core.pytest import * # noqa: F401 +from capyc.pytest.core import * # noqa: F401 from .fixtures import * # noqa: F401 diff --git a/capyc/django/pytest/fixtures/__init__.py b/capyc/pytest/django/fixtures/__init__.py similarity index 100% rename from capyc/django/pytest/fixtures/__init__.py rename to capyc/pytest/django/fixtures/__init__.py diff --git a/capyc/django/pytest/fixtures/database.py b/capyc/pytest/django/fixtures/database.py similarity index 100% rename from capyc/django/pytest/fixtures/database.py rename to capyc/pytest/django/fixtures/database.py diff --git a/capyc/django/pytest/fixtures/queryset.py b/capyc/pytest/django/fixtures/queryset.py similarity index 100% rename from capyc/django/pytest/fixtures/queryset.py rename to capyc/pytest/django/fixtures/queryset.py diff --git a/capyc/django/pytest/fixtures/signals.py b/capyc/pytest/django/fixtures/signals.py similarity index 100% rename from capyc/django/pytest/fixtures/signals.py rename to capyc/pytest/django/fixtures/signals.py diff --git a/capyc/newrelic/pytest/__init__.py b/capyc/pytest/newrelic/__init__.py similarity index 100% rename from capyc/newrelic/pytest/__init__.py rename to capyc/pytest/newrelic/__init__.py diff --git a/capyc/newrelic/pytest/fixtures/__init__.py b/capyc/pytest/newrelic/fixtures/__init__.py similarity index 100% rename from capyc/newrelic/pytest/fixtures/__init__.py rename to capyc/pytest/newrelic/fixtures/__init__.py diff --git a/capyc/newrelic/pytest/fixtures/disable_new_relic.py b/capyc/pytest/newrelic/fixtures/disable_new_relic.py similarity index 100% rename from capyc/newrelic/pytest/fixtures/disable_new_relic.py rename to capyc/pytest/newrelic/fixtures/disable_new_relic.py diff --git a/capyc/newrelic/pytest/fixtures/disable_newrelic_prints.py b/capyc/pytest/newrelic/fixtures/disable_newrelic_prints.py similarity index 100% rename from capyc/newrelic/pytest/fixtures/disable_newrelic_prints.py rename to capyc/pytest/newrelic/fixtures/disable_newrelic_prints.py diff --git a/capyc/pytest/rest_framework/__init__.py b/capyc/pytest/rest_framework/__init__.py new file mode 100644 index 000000000..5b2cb982f --- /dev/null +++ b/capyc/pytest/rest_framework/__init__.py @@ -0,0 +1,5 @@ +"""Centralized Breathecode fixtures for all our libraries.""" + +from capyc.pytest.django import * # noqa: F401 + +from .fixtures import * # noqa: F401 diff --git a/capyc/pytest/rest_framework/fixtures/__init__.py b/capyc/pytest/rest_framework/fixtures/__init__.py new file mode 100644 index 000000000..64eb8367e --- /dev/null +++ b/capyc/pytest/rest_framework/fixtures/__init__.py @@ -0,0 +1,3 @@ +"""Centralized Breathecode fixtures for all our libraries.""" + +from .client import * # noqa: F401 diff --git a/capyc/pytest/rest_framework/fixtures/client.py b/capyc/pytest/rest_framework/fixtures/client.py new file mode 100644 index 000000000..9f7a5ea90 --- /dev/null +++ b/capyc/pytest/rest_framework/fixtures/client.py @@ -0,0 +1,19 @@ +""" +QuerySet fixtures. +""" + +import pytest +from adrf.test import AsyncAPIClient as AsyncClient +from rest_framework.test import APIClient as Client + +__all__ = ["client", "aclient", "Client", "AsyncClient"] + + +@pytest.fixture +def client(): + return Client() + + +@pytest.fixture +def aclient(): + return AsyncClient() diff --git a/capyc/rest_framework/pytest/__init__.py b/capyc/rest_framework/pytest/__init__.py index 8b6605c5e..5b2cb982f 100644 --- a/capyc/rest_framework/pytest/__init__.py +++ b/capyc/rest_framework/pytest/__init__.py @@ -1,5 +1,5 @@ """Centralized Breathecode fixtures for all our libraries.""" -from capyc.django.pytest import * # noqa: F401 +from capyc.pytest.django import * # noqa: F401 from .fixtures import * # noqa: F401 diff --git a/conftest.py b/conftest.py index f97d846d7..20fc337ea 100644 --- a/conftest.py +++ b/conftest.py @@ -10,19 +10,19 @@ from breathecode.notify.utils.hook_manager import HookManagerClass from breathecode.utils.exceptions import TestError -from capyc.core.pytest.fixtures import Random -from capyc.django.pytest.fixtures.signals import Signals +from capyc.pytest.core.fixtures import Random +from capyc.pytest.django.fixtures.signals import Signals # set ENV as test before run django os.environ["ENV"] = "test" os.environ["DATABASE_URL"] = "sqlite:///:memory:" pytest_plugins = ( - "capyc.core.pytest", - "capyc.newrelic.pytest", - "capyc.django.pytest", - "capyc.rest_framework.pytest", - "capyc.circuitbreaker.pytest", + "capyc.pytest.core", + "capyc.pytest.newrelic", + "capyc.pytest.django", + "capyc.pytest.rest_framework", + "capyc.pytest.circuitbreaker", ) from breathecode.tests.mixins.breathecode_mixin import Breathecode