Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
BPL-250 Fudge for coverage bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Stewart Perrygrove committed Nov 12, 2021
1 parent 032ef56 commit e7cc70f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ branch = True

[report]
fail_under = 85
exclude_lines = pragma: no cover
exclude_lines =
pragma: no cover
pragma: coverage bug 1012
2 changes: 1 addition & 1 deletion app/api/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 4 additions & 2 deletions app/api/endpoints/voucher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))))
Expand Down
2 changes: 1 addition & 1 deletion app/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion app/models/account_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion app/models/retailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion app/schemas/retailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion app/tasks/error_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
logger = logging.getLogger("tasks")


if TYPE_CHECKING:
if TYPE_CHECKING: # pragma: no cover
from inspect import Traceback


Expand Down
2 changes: 1 addition & 1 deletion app/tasks/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit e7cc70f

Please sign in to comment.