Skip to content

Commit 5f6ecf8

Browse files
committed
pylint and pytest fixes
1 parent 15860bd commit 5f6ecf8

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

src/cloudformation_cli_python_lib/recast.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ def _field_to_type(field: Any, key: str, classes: Dict[str, Any]) -> Any: # noq
8989
possible_types = field.__args__
9090
if not possible_types:
9191
raise InvalidRequest(f"Cannot process type {field} for field {key}")
92-
except AttributeError as ae:
93-
raise InvalidRequest(f"Cannot process type {field} for field {key}") from ae
92+
except AttributeError as attribute_error:
93+
raise InvalidRequest(
94+
f"Cannot process type {field} for field {key}"
95+
) from attribute_error
9496
# Assuming that the union is generated from typing.Optional, so only
9597
# contains one type and None
9698
# pylint: disable=unidiomatic-typecheck

tests/lib/interface_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55

66
import boto3
77
import pytest
8-
import hypothesis.strategies as s
9-
from hypothesis import given
108
from cloudformation_cli_python_lib.interface import (
119
BaseModel,
1210
HandlerErrorCode,
1311
OperationStatus,
1412
ProgressEvent,
1513
)
1614

15+
import hypothesis.strategies as s
16+
from hypothesis import given
17+
1718

1819
@pytest.fixture(scope="module")
1920
def client():

tests/lib/metrics_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
import boto3
77
import pytest
8-
from botocore.stub import Stubber
98
from cloudformation_cli_python_lib.interface import Action, MetricTypes, StandardUnit
109
from cloudformation_cli_python_lib.metrics import (
1110
MetricPublisher,
1211
MetricsPublisherProxy,
1312
format_dimensions,
1413
)
1514

15+
from botocore.stub import Stubber
16+
1617
RESOURCE_TYPE = "Aa::Bb::Cc"
1718
NAMESPACE = MetricsPublisherProxy._make_namespace( # pylint: disable=protected-access
1819
RESOURCE_TYPE

tests/lib/utils_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from unittest.mock import Mock, call, sentinel
44

55
import pytest
6-
import hypothesis.strategies as s
7-
from hypothesis import given
86
from cloudformation_cli_python_lib.exceptions import InvalidRequest
97
from cloudformation_cli_python_lib.interface import BaseModel
108
from cloudformation_cli_python_lib.utils import (
@@ -14,6 +12,9 @@
1412
deserialize_list,
1513
)
1614

15+
import hypothesis.strategies as s
16+
from hypothesis import given
17+
1718

1819
def roundtrip(value):
1920
return json.loads(json.dumps(value, cls=KitchenSinkEncoder))

tests/plugin/codegen_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ def test_initialize(project):
9494
"README.md",
9595
"foo-bar-baz.json",
9696
"requirements.txt",
97+
"inputs",
98+
"inputs/inputs_1_update.json",
99+
"inputs/inputs_1_invalid.json",
100+
"inputs/inputs_1_create.json",
97101
"src",
98102
"src/foo_bar_baz",
99103
"src/foo_bar_baz/__init__.py",

0 commit comments

Comments
 (0)