Skip to content

Commit 30009f6

Browse files
s-gattichulspro
s-gatti
authored andcommitted
Apply formatter and fix linter issues
Signed-off-by: Sathvik K Gatti <[email protected]> Signed-off-by: Suyambulingam Rathinasamy Muthupandi <[email protected]> Signed-off-by: Charles Kim <[email protected]>
1 parent 519ff00 commit 30009f6

File tree

7 files changed

+32
-19
lines changed

7 files changed

+32
-19
lines changed

test_collections/matter/sdk_tests/support/chip/chip_server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ async def start(
122122
self.__use_paa_certs = use_paa_certs
123123
self.__server_type = server_type
124124

125-
126125
if server_type == ChipServerType.CHIP_CAMERA_CONTROLLER:
127126
prefix = CHIP_CAMERA_CONTROLLER_EXE
128127
command = ["interactive", "server"]

test_collections/matter/sdk_tests/support/yaml_tests/models/chip_suite.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ async def setup(self) -> None:
8989
self.runner.reset_pics_state()
9090

9191
self.__dut_commissioned_successfully = False
92-
if self.server_type == ChipServerType.CHIP_TOOL or self.server_type == ChipServerType.CHIP_CAMERA_CONTROLLER:
92+
if (
93+
self.server_type == ChipServerType.CHIP_TOOL
94+
or self.server_type == ChipServerType.CHIP_CAMERA_CONTROLLER
95+
):
9396
logger.info("Commission DUT")
9497
user_response = await prompt_for_commissioning_mode(
9598
self, logger, None, self.cancel
@@ -227,7 +230,10 @@ async def cleanup(self) -> None:
227230
# Only unpair if commissioning was successfull during setup
228231
if self.__dut_commissioned_successfully:
229232
# Unpair is not applicable for simulated apps case
230-
if self.server_type == ChipServerType.CHIP_TOOL or self.server_type == ChipServerType.CHIP_CAMERA_CONTROLLER:
233+
if (
234+
self.server_type == ChipServerType.CHIP_TOOL
235+
or self.server_type == ChipServerType.CHIP_CAMERA_CONTROLLER
236+
):
231237
logger.info("Unpairing DUT from server")
232238
await self.runner.unpair()
233239
elif self.server_type == ChipServerType.CHIP_APP:

test_collections/matter/sdk_tests/support/yaml_tests/models/test_case.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
from ...chip.chip_server import ChipServerType
2929
from ...models.matter_test_models import MatterTestStep, MatterTestType
3030
from ...yaml_tests.models.chip_test import ChipManualPromptTest, ChipTest
31-
from .yaml_test_models import YamlTest
3231
from .test_suite import SuiteType
32+
from .yaml_test_models import YamlTest
3333

3434
# Custom type variable used to annotate the factory method in YamlTestCase.
3535
T = TypeVar("T", bound="YamlTestCase")
@@ -173,7 +173,8 @@ def _append_automated_test_step(self, yaml_step: MatterTestStep) -> None:
173173
Disabled steps are ignored.
174174
(Such tests will be marked as 'Steps Disabled' elsewhere)
175175
176-
UserPrompt, PromptWithResponse or VerifyVideoStream are special cases that will prompt test operator for input.
176+
UserPrompt, PromptWithResponse or VerifyVideoStream are special cases that will
177+
prompt test operator for input.
177178
"""
178179
if yaml_step.disabled:
179180
test_engine_logger.info(
@@ -182,7 +183,11 @@ def _append_automated_test_step(self, yaml_step: MatterTestStep) -> None:
182183
return
183184

184185
step = TestStep(yaml_step.label)
185-
if yaml_step.command in ["UserPrompt", "PromptWithResponse", "VerifyVideoStream"]:
186+
if yaml_step.command in [
187+
"UserPrompt",
188+
"PromptWithResponse",
189+
"VerifyVideoStream",
190+
]:
186191
step = ManualVerificationTestStep(
187192
name=yaml_step.label,
188193
verification=yaml_step.verification,

test_collections/matter/sdk_tests/support/yaml_tests/models/test_declarations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from typing import Type
16+
from typing import Optional, Type
1717

1818
from app.test_engine.models.test_declarations import (
1919
TestCaseDeclaration,
@@ -26,7 +26,6 @@
2626
from .test_case import YamlTestCase
2727
from .test_suite import SuiteType, YamlTestSuite
2828
from .yaml_test_models import YamlTest
29-
from typing import Optional
3029

3130

3231
class YamlCollectionDeclaration(TestCollectionDeclaration):

test_collections/matter/sdk_tests/support/yaml_tests/models/yaml_test_models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from typing import Any
16+
from typing import Any, Optional
1717

1818
from pydantic_yaml import YamlModelMixin
1919

2020
from ...models.matter_test_models import MatterTest
21-
2221
from .test_suite import SuiteType
23-
from typing import Optional
2422

2523
###
2624
# This file declares YAML models that are used to parse the YAML Test Cases.
@@ -29,5 +27,6 @@
2927

3028
class YamlTest(YamlModelMixin, MatterTest):
3129
suite_type: Optional[SuiteType] = None
30+
3231
def __init__(self, **kwargs: Any) -> None:
3332
super().__init__(steps=kwargs["tests"], **kwargs)

test_collections/matter/sdk_tests/support/yaml_tests/models/yaml_test_parser.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import re
1617
from pathlib import Path
1718

1819
from loguru import logger
1920
from pydantic import ValidationError
2021

2122
from ...models.matter_test_models import MatterTestType
22-
from .yaml_test_models import YamlTest
2323
from .test_suite import SuiteType
24-
import re
24+
from .yaml_test_models import YamlTest
2525

2626

2727
class YamlParserException(Exception):
@@ -60,8 +60,12 @@ def _get_types(test: YamlTest) -> tuple[MatterTestType, SuiteType]:
6060
if all(s.disabled is True for s in steps):
6161
return MatterTestType.MANUAL, SuiteType.MANUAL
6262

63-
# if any step has a UserPrompt, PromptWithResponse or VerifyVideoStream command, categorize as semi-automated
64-
if any(s.command in ["UserPrompt", "PromptWithResponse", "VerifyVideoStream"] for s in steps):
63+
# if any step has a UserPrompt, PromptWithResponse or VerifyVideoStream command,
64+
# categorize as semi-automated
65+
if any(
66+
s.command in ["UserPrompt", "PromptWithResponse", "VerifyVideoStream"]
67+
for s in steps
68+
):
6569
if re.search(camera_test_pattern, test.name):
6670
return MatterTestType.SEMI_AUTOMATED, SuiteType.CAMERA_AUTOMATED
6771
else:
@@ -72,7 +76,8 @@ def _get_types(test: YamlTest) -> tuple[MatterTestType, SuiteType]:
7276
if re.search(camera_test_pattern, test.name):
7377
return MatterTestType.AUTOMATED, SuiteType.CAMERA_AUTOMATED
7478
else:
75-
return MatterTestType.AUTOMATED, SuiteType.AUTOMATED
79+
return MatterTestType.AUTOMATED, SuiteType.AUTOMATED
80+
7681

7782
def parse_yaml_test(path: Path) -> YamlTest:
7883
"""Parse a single YAML file into YamlTest model.

test_collections/matter/sdk_tests/support/yaml_tests/sdk_yaml_tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _init_test_suites(yaml_version: str) -> dict[SuiteType, YamlSuiteDeclaration
7676
name="CameraAppTestSuite",
7777
suite_type=SuiteType.CAMERA_AUTOMATED,
7878
version=yaml_version,
79-
)
79+
),
8080
}
8181

8282

@@ -110,9 +110,9 @@ def _parse_all_yaml(
110110
suites[SuiteType.SIMULATED].add_test_case(test_case)
111111
else:
112112
if test_case.suite_type == SuiteType.CAMERA_AUTOMATED:
113-
suites[SuiteType.CAMERA_AUTOMATED].add_test_case(test_case)
113+
suites[SuiteType.CAMERA_AUTOMATED].add_test_case(test_case)
114114
else:
115-
suites[SuiteType.AUTOMATED].add_test_case(test_case)
115+
suites[SuiteType.AUTOMATED].add_test_case(test_case)
116116

117117
except YamlParserException:
118118
# If an exception was raised during parse process, the yaml file will be

0 commit comments

Comments
 (0)