Skip to content

Commit 7cc3003

Browse files
authored
chore: Enable linting for tests and integration (#2895)
1 parent d39192c commit 7cc3003

File tree

139 files changed

+369
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+369
-378
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ init:
66
pip install -e '.[dev]'
77

88
test:
9-
AWS_DEFAULT_REGION=us-east-1 pytest --cov samtranslator --cov-report term-missing --cov-fail-under 95 -n auto tests/*
9+
AWS_DEFAULT_REGION=us-east-1 pytest --cov samtranslator --cov-report term-missing --cov-fail-under 95 -n auto tests/
1010

1111
test-fast:
12-
pytest -x --cov samtranslator --cov-report term-missing --cov-fail-under 95 -n auto tests/*
12+
pytest -x --cov samtranslator --cov-report term-missing --cov-fail-under 95 -n auto tests/
1313

1414
test-cov-report:
15-
pytest --cov samtranslator --cov-report term-missing --cov-report html --cov-fail-under 95 tests/*
15+
pytest --cov samtranslator --cov-report term-missing --cov-report html --cov-fail-under 95 tests/
1616

1717
integ-test:
1818
pytest --no-cov integration/*
1919

2020
black:
21-
black setup.py samtranslator/* tests/* integration/* bin/*.py schema_source
21+
black setup.py samtranslator tests integration bin schema_source
2222
bin/json-format.py --write tests integration samtranslator/policy_templates_data
2323
bin/yaml-format.py --write tests
2424
bin/yaml-format.py --write integration --add-test-metadata
@@ -29,20 +29,20 @@ black-check:
2929
python -m schema_source.schema --sam-schema .tmp/sam.schema.json --cfn-schema schema_source/cloudformation.schema.json --unified-schema .tmp/schema.json
3030
diff -u schema_source/sam.schema.json .tmp/sam.schema.json
3131
diff -u samtranslator/schema/schema.json .tmp/schema.json
32-
black --check setup.py samtranslator/* tests/* integration/* bin/*.py schema_source
32+
black --check setup.py samtranslator tests integration bin schema_source
3333
bin/json-format.py --check tests integration samtranslator/policy_templates_data
3434
bin/yaml-format.py --check tests
3535
bin/yaml-format.py --check integration --add-test-metadata
3636

3737
lint:
38-
ruff samtranslator bin schema_source
38+
ruff samtranslator bin schema_source integration tests
3939
# mypy performs type check
4040
mypy --strict samtranslator bin schema_source
4141
# cfn-lint to make sure generated CloudFormation makes sense
4242
bin/run_cfn_lint.sh
4343

4444
lint-fix:
45-
ruff --fix samtranslator bin schema_source
45+
ruff --fix samtranslator bin schema_source integration tests
4646

4747
prepare-companion-stack:
4848
pytest -v --no-cov integration/setup -m setup

integration/combination/test_api_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import hashlib
22
from unittest.case import skipIf
33

4-
from integration.helpers.resource import current_region_does_not_support
54
from integration.config.service_names import REST_API
5+
from integration.helpers.resource import current_region_does_not_support
66

77
try:
88
from pathlib import Path

integration/combination/test_api_with_authorizer_apikey.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
from unittest.case import skipIf
22

3+
from integration.config.service_names import API_KEY, REST_API
34
from integration.helpers.base_test import BaseTest
45
from integration.helpers.deployer.utils.retry import retry
56
from integration.helpers.exception import StatusCodeError
6-
7-
87
from integration.helpers.resource import current_region_does_not_support
9-
from integration.config.service_names import REST_API, API_KEY
108

119

1210
@skipIf(current_region_does_not_support([REST_API, API_KEY]), "RestApi/ApiKey is not supported in this testing region")

integration/combination/test_api_with_authorizers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from unittest.case import skipIf
22

3+
from integration.config.service_names import API_KEY, COGNITO, REST_API
34
from integration.helpers.base_test import BaseTest
45
from integration.helpers.deployer.utils.retry import retry
56
from integration.helpers.exception import StatusCodeError
67
from integration.helpers.resource import current_region_does_not_support
7-
from integration.config.service_names import API_KEY, COGNITO, REST_API
88

99

1010
@skipIf(

integration/combination/test_api_with_cors.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
from integration.helpers.base_test import BaseTest
2-
import requests
31
from unittest.case import skipIf
42

3+
from parameterized import parameterized
4+
5+
from integration.config.service_names import REST_API
56
from integration.helpers.base_test import BaseTest
67
from integration.helpers.resource import current_region_does_not_support
7-
from integration.config.service_names import REST_API
8-
from integration.helpers.deployer.utils.retry import retry
9-
from parameterized import parameterized
108

119
ALL_METHODS = "DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT"
1210

integration/combination/test_api_with_disable_execute_api_endpoint.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from unittest.case import skipIf
2+
23
from parameterized import parameterized
34

5+
from integration.config.service_names import REST_API
46
from integration.helpers.base_test import BaseTest
5-
6-
77
from integration.helpers.resource import current_region_does_not_support
8-
from integration.config.service_names import REST_API
98

109

1110
@skipIf(current_region_does_not_support([REST_API]), "RestApi is not supported in this testing region")
@@ -41,7 +40,7 @@ def test_end_point_configuration(self, file_name, disable_value):
4140
("combination/api_with_disable_execute_api_endpoint_openapi_3", False),
4241
]
4342
)
44-
def test_end_point_configuration(self, file_name, disable_value):
43+
def test_end_point_configuration_openapi(self, file_name, disable_value):
4544
parameters = [
4645
{
4746
"ParameterKey": "DisableExecuteApiEndpointValue",

integration/combination/test_api_with_fail_on_warnings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from unittest.case import skipIf
2+
23
from parameterized import parameterized
34

5+
from integration.config.service_names import REST_API
46
from integration.helpers.base_test import BaseTest
57
from integration.helpers.resource import current_region_does_not_support
6-
from integration.config.service_names import REST_API
78

89

910
@skipIf(current_region_does_not_support([REST_API]), "RestApi is not supported in this testing region")

integration/combination/test_api_with_gateway_responses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import logging
22
from unittest.case import skipIf
33

4-
from tenacity import stop_after_attempt, retry_if_exception_type, after_log, wait_exponential, retry, wait_random
4+
from tenacity import after_log, retry, retry_if_exception_type, stop_after_attempt, wait_exponential, wait_random
55

6+
from integration.config.service_names import GATEWAY_RESPONSES, REST_API
67
from integration.helpers.base_test import BaseTest
78
from integration.helpers.resource import current_region_does_not_support
8-
from integration.config.service_names import GATEWAY_RESPONSES, REST_API
99

1010
LOG = logging.getLogger(__name__)
1111

integration/combination/test_api_with_resource_policies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import json
22
from unittest.case import skipIf
33

4+
from integration.config.service_names import REST_API
45
from integration.helpers.base_test import BaseTest
56
from integration.helpers.resource import current_region_does_not_support
6-
from integration.config.service_names import REST_API
77

88

99
@skipIf(current_region_does_not_support([REST_API]), "Rest API is not supported in this testing region")

integration/combination/test_api_with_usage_plan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from unittest.case import skipIf
22

3+
from integration.config.service_names import REST_API, USAGE_PLANS
34
from integration.helpers.base_test import BaseTest
45
from integration.helpers.resource import current_region_does_not_support
5-
from integration.config.service_names import USAGE_PLANS, REST_API
66

77

88
@skipIf(current_region_does_not_support([USAGE_PLANS, REST_API]), "UsagePlans is not supported in this testing region")

0 commit comments

Comments
 (0)