Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit e7cc70f

Browse files
author
Stewart Perrygrove
committed
BPL-250 Fudge for coverage bug
See nedbat/coveragepy#1012 & nedbat/coveragepy#1082
1 parent 032ef56 commit e7cc70f

File tree

10 files changed

+15
-11
lines changed

10 files changed

+15
-11
lines changed

.coveragerc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ branch = True
1010

1111
[report]
1212
fail_under = 85
13-
exclude_lines = pragma: no cover
13+
exclude_lines =
14+
pragma: no cover
15+
pragma: coverage bug 1012

app/api/deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from app.db.session import AsyncSessionMaker
1010
from app.enums import HttpErrors
1111

12-
if TYPE_CHECKING:
12+
if TYPE_CHECKING: # pragma: no cover
1313
from app.models import RetailerConfig
1414

1515

app/api/endpoints/voucher.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ async def update_voucher_status(
3131
update_data = payload.dict(exclude_unset=True)
3232
voucher = await crud.get_voucher(db_session, voucher_id, retailer.id)
3333
incorrect_response_payload = {"display_message": "Voucher status incorrect.", "error": "STATUS_NOT_CHANGED"}
34-
if voucher.status != AccountHolderVoucherStatuses.ISSUED:
34+
if voucher.status != AccountHolderVoucherStatuses.ISSUED: # pragma: coverage bug 1012
3535
response.status_code = status.HTTP_202_ACCEPTED
3636
return incorrect_response_payload
37-
if voucher.expiry_date < datetime.utcnow() and voucher.expiry_date < update_data["date"]:
37+
if (
38+
voucher.expiry_date < datetime.utcnow() and voucher.expiry_date < update_data["date"]
39+
): # pragma: coverage bug 1012
3840
if update_data["status"] == AccountHolderVoucherStatuses.CANCELLED:
3941
response.status_code = status.HTTP_202_ACCEPTED
4042
return incorrect_response_payload

app/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from app.core.key_vault import KeyVault
1313

14-
if TYPE_CHECKING:
14+
if TYPE_CHECKING: # pragma: no cover
1515
from pydantic.typing import CallableGenerator
1616

1717
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

app/core/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from app.enums import HttpErrors
1111

12-
if TYPE_CHECKING:
12+
if TYPE_CHECKING: # pragma: no cover
1313
from pydantic.typing import CallableGenerator # pragma: no cover
1414

1515

app/models/account_holder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from app.db.base_class import Base, TimestampMixin, utc_timestamp_sql
1010
from app.enums.account_holder import AccountHolderStatuses, AccountHolderVoucherStatuses
1111

12-
if TYPE_CHECKING:
12+
if TYPE_CHECKING: # pragma: no cover
1313
from .retailer import RetailerConfig # noqa 640 pragma: no cover
1414

1515

app/models/retailer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from app.db.base_class import Base, TimestampMixin
77

8-
if TYPE_CHECKING:
8+
if TYPE_CHECKING: # pragma: no cover
99
from .account_holder import AccountHolder # noqa 640 pragma: no cover
1010

1111

app/schemas/retailer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from pydantic import EmailStr, Field, constr, create_model
55

6-
if TYPE_CHECKING:
6+
if TYPE_CHECKING: # pragma: no cover
77
from pydantic import BaseModel # pragma: no cover
88

99

app/tasks/error_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
logger = logging.getLogger("tasks")
1313

1414

15-
if TYPE_CHECKING:
15+
if TYPE_CHECKING: # pragma: no cover
1616
from inspect import Traceback
1717

1818

app/tasks/prometheus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from prometheus_client import Counter
44

5-
if TYPE_CHECKING:
5+
if TYPE_CHECKING: # pragma: no cover
66
from requests import RequestException, Response # pragma: no cover
77

88

0 commit comments

Comments
 (0)