diff --git a/.coveragerc b/.coveragerc index f2be02fa..11b2c04c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,4 +10,6 @@ branch = True [report] fail_under = 85 -exclude_lines = pragma: no cover +exclude_lines = + pragma: no cover + pragma: coverage bug 1012 \ No newline at end of file diff --git a/app/api/deps.py b/app/api/deps.py index 996988d2..c919d8df 100644 --- a/app/api/deps.py +++ b/app/api/deps.py @@ -9,7 +9,7 @@ from app.db.session import AsyncSessionMaker from app.enums import HttpErrors -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from app.models import RetailerConfig diff --git a/app/api/endpoints/voucher.py b/app/api/endpoints/voucher.py index cca5333f..bb5e210a 100644 --- a/app/api/endpoints/voucher.py +++ b/app/api/endpoints/voucher.py @@ -31,10 +31,12 @@ async def update_voucher_status( update_data = payload.dict(exclude_unset=True) voucher = await crud.get_voucher(db_session, voucher_id, retailer.id) incorrect_response_payload = {"display_message": "Voucher status incorrect.", "error": "STATUS_NOT_CHANGED"} - if voucher.status != AccountHolderVoucherStatuses.ISSUED: + if voucher.status != AccountHolderVoucherStatuses.ISSUED: # pragma: coverage bug 1012 response.status_code = status.HTTP_202_ACCEPTED return incorrect_response_payload - if voucher.expiry_date < datetime.utcnow() and voucher.expiry_date < update_data["date"]: + if ( + voucher.expiry_date < datetime.utcnow() and voucher.expiry_date < update_data["date"] + ): # pragma: coverage bug 1012 if update_data["status"] == AccountHolderVoucherStatuses.CANCELLED: response.status_code = status.HTTP_202_ACCEPTED return incorrect_response_payload diff --git a/app/core/config.py b/app/core/config.py index 0accfd79..4fece058 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -11,7 +11,7 @@ from app.core.key_vault import KeyVault -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from pydantic.typing import CallableGenerator BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) diff --git a/app/core/utils.py b/app/core/utils.py index cab790c0..103907db 100644 --- a/app/core/utils.py +++ b/app/core/utils.py @@ -9,7 +9,7 @@ from app.enums import HttpErrors -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from pydantic.typing import CallableGenerator # pragma: no cover diff --git a/app/models/account_holder.py b/app/models/account_holder.py index b9d44f87..64219568 100644 --- a/app/models/account_holder.py +++ b/app/models/account_holder.py @@ -9,7 +9,7 @@ from app.db.base_class import Base, TimestampMixin, utc_timestamp_sql from app.enums.account_holder import AccountHolderStatuses, AccountHolderVoucherStatuses -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .retailer import RetailerConfig # noqa 640 pragma: no cover diff --git a/app/models/retailer.py b/app/models/retailer.py index 540baeac..8997b257 100644 --- a/app/models/retailer.py +++ b/app/models/retailer.py @@ -5,7 +5,7 @@ from app.db.base_class import Base, TimestampMixin -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from .account_holder import AccountHolder # noqa 640 pragma: no cover diff --git a/app/schemas/retailer.py b/app/schemas/retailer.py index 30f15f1a..b109e331 100644 --- a/app/schemas/retailer.py +++ b/app/schemas/retailer.py @@ -3,7 +3,7 @@ from pydantic import EmailStr, Field, constr, create_model -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from pydantic import BaseModel # pragma: no cover diff --git a/app/tasks/error_handlers.py b/app/tasks/error_handlers.py index 46ca7d42..cd483207 100644 --- a/app/tasks/error_handlers.py +++ b/app/tasks/error_handlers.py @@ -12,7 +12,7 @@ logger = logging.getLogger("tasks") -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from inspect import Traceback diff --git a/app/tasks/prometheus.py b/app/tasks/prometheus.py index 9cf8fa08..56259c9a 100644 --- a/app/tasks/prometheus.py +++ b/app/tasks/prometheus.py @@ -2,7 +2,7 @@ from prometheus_client import Counter -if TYPE_CHECKING: +if TYPE_CHECKING: # pragma: no cover from requests import RequestException, Response # pragma: no cover