Skip to content

Commit efaa69e

Browse files
committed
chore: skip coverage on false positives
1 parent 5634b30 commit efaa69e

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,13 +1646,13 @@ def _determine_openapi_version(openapi_version):
16461646
from aws_lambda_powertools.event_handler.openapi.pydantic_loader import PYDANTIC_V2
16471647

16481648
# Pydantic V2 has no support for OpenAPI schema 3.0
1649-
if PYDANTIC_V2 and not openapi_version.startswith("3.1"):
1649+
if PYDANTIC_V2 and not openapi_version.startswith("3.1"): # pragma: no cover
16501650
warnings.warn(
16511651
"You are using Pydantic v2, which is incompatible with OpenAPI schema 3.0. Forcing OpenAPI 3.1",
16521652
stacklevel=2,
16531653
)
16541654
openapi_version = "3.1.0"
1655-
elif not PYDANTIC_V2 and not openapi_version.startswith("3.0"):
1655+
elif not PYDANTIC_V2 and not openapi_version.startswith("3.0"): # pragma: no cover
16561656
warnings.warn(
16571657
"You are using Pydantic v1, which is incompatible with OpenAPI schema 3.1. Forcing OpenAPI 3.0",
16581658
stacklevel=2,
@@ -2192,7 +2192,7 @@ def not_found(self, func: Optional[Callable] = None):
21922192

21932193
def exception_handler(self, exc_class: Union[Type[Exception], List[Type[Exception]]]):
21942194
def register_exception_handler(func: Callable):
2195-
if isinstance(exc_class, list):
2195+
if isinstance(exc_class, list): # pragma: no cover
21962196
for exp in exc_class:
21972197
self._exception_handlers[exp] = func
21982198
else:

aws_lambda_powertools/event_handler/openapi/compat.py

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

4141
RequestErrorModel: Type[BaseModel] = create_model("Request")
4242

43-
if PYDANTIC_V2:
43+
if PYDANTIC_V2: # pragma: no cover # false positive; dropping in v3
4444
from pydantic import TypeAdapter, ValidationError
4545
from pydantic._internal._typing_extra import eval_type_lenient
4646
from pydantic.fields import FieldInfo

aws_lambda_powertools/event_handler/openapi/pydantic_loader.py

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

44
PYDANTIC_V2 = PYDANTIC_VERSION.startswith("2.")
55
except ImportError:
6-
PYDANTIC_V2 = False
6+
PYDANTIC_V2 = False # pragma: no cover # false positive; dropping in v3

aws_lambda_powertools/utilities/batch/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# For IntelliSense and Mypy to work, we need to account for possible SQS subclasses
99
# We need them as subclasses as we must access their message ID or sequence number metadata via dot notation
10-
if has_pydantic:
10+
if has_pydantic: # pragma: no cover
1111
from aws_lambda_powertools.utilities.parser.models import DynamoDBStreamRecordModel, SqsRecordModel
1212
from aws_lambda_powertools.utilities.parser.models import (
1313
KinesisDataStreamRecord as KinesisDataStreamRecordModel,
@@ -17,7 +17,7 @@
1717
Union[Type[SqsRecordModel], Type[DynamoDBStreamRecordModel], Type[KinesisDataStreamRecordModel]]
1818
]
1919
BatchSqsTypeModel = Optional[Type[SqsRecordModel]]
20-
else:
20+
else: # pragma: no cover
2121
BatchTypeModels = "BatchTypeModels" # type: ignore
2222
BatchSqsTypeModel = "BatchSqsTypeModel" # type: ignore
2323

aws_lambda_powertools/utilities/parser/compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ def disable_pydantic_v2_warning():
2222

2323
version = __version__.split(".")
2424

25-
if int(version[0]) == 2:
25+
if int(version[0]) == 2: # pragma: no cover # dropping in v3
2626
import warnings
2727

2828
from pydantic import PydanticDeprecatedSince20, PydanticDeprecationWarning
2929

3030
warnings.filterwarnings("ignore", category=PydanticDeprecationWarning)
3131
warnings.filterwarnings("ignore", category=PydanticDeprecatedSince20)
3232

33-
except ImportError:
33+
except ImportError: # pragma: no cover # false positive; dropping in v3
3434
pass

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ omit = [
129129
"aws_lambda_powertools/exceptions/*",
130130
"aws_lambda_powertools/utilities/parser/types.py",
131131
"aws_lambda_powertools/utilities/jmespath_utils/envelopes.py",
132+
"aws_lambda_powertools/metrics/metric.py" # barrel import (export-only)
132133
]
133134
branch = true
134135

0 commit comments

Comments
 (0)