From 13c673700c7590f8bd74c3299fbb54b4a1b043ef Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Tue, 10 Sep 2024 18:30:51 +0000
Subject: [PATCH 01/19] Add support for configuring terms and conditions in
 device commissioning

This commit introduces a new `enhanced_setup_flow` configuration
property to the test harness backend, allowing device manufacturers to
define the terms and conditions (T&C) that must be acknowledged and set
during device commissioning. These values are critical for supporting
the Terms and Conditions Certification Test Suite.

Key changes include:
- Added the `EnhancedSetupFlowConfig` class to `DutConfig`, which allows
  specifying the T&C version and user response required during
  commissioning.
- Updated `generate_command_arguments` in `utils.py` to append the
  necessary arguments for T&C validation and the device's commissioning
  method.
- Adjusted model validation to ensure the `enhanced_setup_flow` field is
  processed correctly within `DutConfig`.

These changes ensure the test harness can enforce manufacturer-specific
T&C values during the commissioning process, aligning with the broader
requirements of T&C validation.
---
 .../support/python_testing/models/utils.py    | 24 ++++++++++++-------
 .../matter/test_environment_config.py         |  7 ++++++
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
index e410f7b0..8b83a816 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2023 Project CHIP Authors
+# Copyright (c) 2023-2024 Project CHIP Authors
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -55,16 +55,24 @@ async def generate_command_arguments(
     if dut_config.trace_log:
         arguments.append("--trace-to json:log")
 
-    if not omit_commissioning_method:
+    if dut_config.enhanced_setup_flow:
+        arguments.append(f"--require-tc-acknowledgements 1")
+        arguments.append(f"--tc-acknowledgements {dut_config.enhanced_setup_flow.tc_user_response}")
+        arguments.append(f"--tc-acknowledgements-version {dut_config.enhanced_setup_flow.tc_version}")
+
+    if omit_commissioning_method:
+        arguments.append(f"--in-test-commissioning-method {pairing_mode}")
+
+    else:
         arguments.append(f"--commissioning-method {pairing_mode}")
 
-        if pairing_mode == DutPairingModeEnum.BLE_WIFI:
-            arguments.append(f"--wifi-ssid {config.network.wifi.ssid}")
-            arguments.append(f"--wifi-passphrase {config.network.wifi.password}")
+    if pairing_mode == DutPairingModeEnum.BLE_WIFI:
+        arguments.append(f"--wifi-ssid {config.network.wifi.ssid}")
+        arguments.append(f"--wifi-passphrase {config.network.wifi.password}")
 
-        if pairing_mode == DutPairingModeEnum.BLE_THREAD:
-            dataset_hex = await __thread_dataset_hex(config.network.thread)
-            arguments.append(f"--thread-dataset-hex {dataset_hex}")
+    if pairing_mode == DutPairingModeEnum.BLE_THREAD:
+        dataset_hex = await __thread_dataset_hex(config.network.thread)
+        arguments.append(f"--thread-dataset-hex {dataset_hex}")
 
     # Retrieve arguments from test_parameters
     if test_parameters:
diff --git a/test_collections/matter/test_environment_config.py b/test_collections/matter/test_environment_config.py
index 5e34a410..cbe88d84 100644
--- a/test_collections/matter/test_environment_config.py
+++ b/test_collections/matter/test_environment_config.py
@@ -46,6 +46,11 @@ class NetworkConfig(BaseModel):
     thread: Union[ThreadAutoConfig, ThreadExternalConfig]
 
 
+class EnhancedSetupFlowConfig(BaseModel):
+    tc_version: int
+    tc_user_response: int
+
+
 class DutConfig(BaseModel):
     discriminator: str
     setup_code: str
@@ -53,6 +58,7 @@ class DutConfig(BaseModel):
     chip_timeout: Optional[str]
     chip_use_paa_certs: bool = False
     trace_log: bool = True
+    enhanced_setup_flow: Optional[EnhancedSetupFlowConfig] = None
 
 
 class TestEnvironmentConfigMatter(TestEnvironmentConfig):
@@ -99,6 +105,7 @@ def validate_model(self, dict_model: dict) -> None:
             # All DutConfig fields but chip_timeout are mandatory
             mandatory_fields = valid_properties.copy()
             mandatory_fields.remove("chip_timeout")
+            mandatory_fields.remove("enhanced_setup_flow")
             for field in mandatory_fields:
                 if field not in dut_config:
                     raise TestEnvironmentConfigMatterError(

From 3291de16ee7bf094f7b6a05c48bd54f77afe03b4 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Mon, 16 Dec 2024 19:40:56 +0000
Subject: [PATCH 02/19] * Ran ./scripts/format.sh

---
 app/user_prompt_support/uploaded_file_support.py     |  3 +--
 .../sdk_tests/support/performance_tests/utils.py     | 12 ++++++------
 .../sdk_tests/support/python_testing/__init__.py     |  6 +++---
 .../sdk_tests/support/python_testing/models/utils.py |  8 ++++++--
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/app/user_prompt_support/uploaded_file_support.py b/app/user_prompt_support/uploaded_file_support.py
index 1d17d183..efb6ed33 100644
--- a/app/user_prompt_support/uploaded_file_support.py
+++ b/app/user_prompt_support/uploaded_file_support.py
@@ -30,8 +30,7 @@ class UploadFile(Protocol):
     filename: Optional[str]
 
     @property
-    def content_type(self) -> Optional[str]:
-        ...
+    def content_type(self) -> Optional[str]: ...
 
 
 @runtime_checkable
diff --git a/test_collections/matter/sdk_tests/support/performance_tests/utils.py b/test_collections/matter/sdk_tests/support/performance_tests/utils.py
index 1759e694..6656c4bc 100644
--- a/test_collections/matter/sdk_tests/support/performance_tests/utils.py
+++ b/test_collections/matter/sdk_tests/support/performance_tests/utils.py
@@ -252,12 +252,12 @@ def generate_summary(
     summary_dict["test_summary_record"]["number_of_iterations_completed"] = len(
         durations
     )
-    summary_dict["test_summary_record"][
-        "number_of_iterations_passed"
-    ] = compute_count_state(execution_status, True)
-    summary_dict["test_summary_record"][
-        "number_of_iterations_failed"
-    ] = compute_count_state(execution_status, False)
+    summary_dict["test_summary_record"]["number_of_iterations_passed"] = (
+        compute_count_state(execution_status, True)
+    )
+    summary_dict["test_summary_record"]["number_of_iterations_failed"] = (
+        compute_count_state(execution_status, False)
+    )
     summary_dict["test_summary_record"]["platform"] = "rpi"
     summary_dict["test_summary_record"]["commissioning_method"] = commissioning_method
     summary_dict["test_summary_record"]["list_of_iterations_failed"] = []
diff --git a/test_collections/matter/sdk_tests/support/python_testing/__init__.py b/test_collections/matter/sdk_tests/support/python_testing/__init__.py
index 6ffac78f..85b5ca8e 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/__init__.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/__init__.py
@@ -34,6 +34,6 @@
         sdk_mandatory_python_test_collection()
     )
 
-    custom_python_collection: Optional[
-        TestCollectionDeclaration
-    ] = custom_python_test_collection()
+    custom_python_collection: Optional[TestCollectionDeclaration] = (
+        custom_python_test_collection()
+    )
diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
index 8b83a816..0bade6e1 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
@@ -57,8 +57,12 @@ async def generate_command_arguments(
 
     if dut_config.enhanced_setup_flow:
         arguments.append(f"--require-tc-acknowledgements 1")
-        arguments.append(f"--tc-acknowledgements {dut_config.enhanced_setup_flow.tc_user_response}")
-        arguments.append(f"--tc-acknowledgements-version {dut_config.enhanced_setup_flow.tc_version}")
+        arguments.append(
+            f"--tc-acknowledgements {dut_config.enhanced_setup_flow.tc_user_response}"
+        )
+        arguments.append(
+            f"--tc-acknowledgements-version {dut_config.enhanced_setup_flow.tc_version}"
+        )
 
     if omit_commissioning_method:
         arguments.append(f"--in-test-commissioning-method {pairing_mode}")

From d93aa8285c5a1467d82846db262cea10877e95ba Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Mon, 16 Dec 2024 19:46:27 +0000
Subject: [PATCH 03/19]

---
 .../matter/sdk_tests/support/python_testing/models/utils.py     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
index 0bade6e1..8228dfdc 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
@@ -56,7 +56,7 @@ async def generate_command_arguments(
         arguments.append("--trace-to json:log")
 
     if dut_config.enhanced_setup_flow:
-        arguments.append(f"--require-tc-acknowledgements 1")
+        arguments.append("--require-tc-acknowledgements 1")
         arguments.append(
             f"--tc-acknowledgements {dut_config.enhanced_setup_flow.tc_user_response}"
         )

From 6d7795c803cd372b13f1ff8ef943896afeda5cdd Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:51:04 -0800
Subject: [PATCH 04/19] Update
 test_collections/matter/test_environment_config.py

Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
---
 test_collections/matter/test_environment_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test_collections/matter/test_environment_config.py b/test_collections/matter/test_environment_config.py
index cbe88d84..786877ca 100644
--- a/test_collections/matter/test_environment_config.py
+++ b/test_collections/matter/test_environment_config.py
@@ -102,7 +102,7 @@ def validate_model(self, dict_model: dict) -> None:
                         f" {valid_properties}"
                     )
 
-            # All DutConfig fields but chip_timeout are mandatory
+            # All DutConfig fields but chip_timeout and enhanced_setup_flow are mandatory
             mandatory_fields = valid_properties.copy()
             mandatory_fields.remove("chip_timeout")
             mandatory_fields.remove("enhanced_setup_flow")

From 1ead31c02c7a381010d02c1271b30fc15e721761 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:52:57 -0800
Subject: [PATCH 05/19] Update app/user_prompt_support/uploaded_file_support.py

Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
---
 app/user_prompt_support/uploaded_file_support.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/user_prompt_support/uploaded_file_support.py b/app/user_prompt_support/uploaded_file_support.py
index efb6ed33..1d17d183 100644
--- a/app/user_prompt_support/uploaded_file_support.py
+++ b/app/user_prompt_support/uploaded_file_support.py
@@ -30,7 +30,8 @@ class UploadFile(Protocol):
     filename: Optional[str]
 
     @property
-    def content_type(self) -> Optional[str]: ...
+    def content_type(self) -> Optional[str]:
+        ...
 
 
 @runtime_checkable

From d6c959d6af350eed890472f0170d03046509300a Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:53:05 -0800
Subject: [PATCH 06/19] Update
 test_collections/matter/sdk_tests/support/performance_tests/utils.py

Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
---
 .../sdk_tests/support/performance_tests/utils.py    | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/performance_tests/utils.py b/test_collections/matter/sdk_tests/support/performance_tests/utils.py
index 6656c4bc..f457887e 100644
--- a/test_collections/matter/sdk_tests/support/performance_tests/utils.py
+++ b/test_collections/matter/sdk_tests/support/performance_tests/utils.py
@@ -252,13 +252,12 @@ def generate_summary(
     summary_dict["test_summary_record"]["number_of_iterations_completed"] = len(
         durations
     )
-    summary_dict["test_summary_record"]["number_of_iterations_passed"] = (
-        compute_count_state(execution_status, True)
-    )
-    summary_dict["test_summary_record"]["number_of_iterations_failed"] = (
-        compute_count_state(execution_status, False)
-    )
-    summary_dict["test_summary_record"]["platform"] = "rpi"
+    summary_dict["test_summary_record"][
+        "number_of_iterations_passed"
+    ] = compute_count_state(execution_status, True)
+    summary_dict["test_summary_record"][
+        "number_of_iterations_failed"
+    ] = compute_count_state(execution_status, False)
     summary_dict["test_summary_record"]["commissioning_method"] = commissioning_method
     summary_dict["test_summary_record"]["list_of_iterations_failed"] = []
     summary_dict["test_summary_record"]["analytics_parameters"] = [

From d7900b785c47c75b52a1b04515dda32ccfb3daf1 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:53:12 -0800
Subject: [PATCH 07/19] Update
 test_collections/matter/sdk_tests/support/python_testing/models/utils.py

Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
---
 .../matter/sdk_tests/support/python_testing/models/utils.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
index 8228dfdc..a7fd5968 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
@@ -70,9 +70,9 @@ async def generate_command_arguments(
     else:
         arguments.append(f"--commissioning-method {pairing_mode}")
 
-    if pairing_mode == DutPairingModeEnum.BLE_WIFI:
-        arguments.append(f"--wifi-ssid {config.network.wifi.ssid}")
-        arguments.append(f"--wifi-passphrase {config.network.wifi.password}")
+        if pairing_mode == DutPairingModeEnum.BLE_WIFI:
+            arguments.append(f"--wifi-ssid {config.network.wifi.ssid}")
+            arguments.append(f"--wifi-passphrase {config.network.wifi.password}")
 
     if pairing_mode == DutPairingModeEnum.BLE_THREAD:
         dataset_hex = await __thread_dataset_hex(config.network.thread)

From 3061a7f1cb9b5882a9b574ea732640be7cb77f02 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:53:23 -0800
Subject: [PATCH 08/19] Update
 test_collections/matter/sdk_tests/support/python_testing/models/utils.py

Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
---
 .../matter/sdk_tests/support/python_testing/models/utils.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
index a7fd5968..cee2d9dd 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/models/utils.py
@@ -74,9 +74,9 @@ async def generate_command_arguments(
             arguments.append(f"--wifi-ssid {config.network.wifi.ssid}")
             arguments.append(f"--wifi-passphrase {config.network.wifi.password}")
 
-    if pairing_mode == DutPairingModeEnum.BLE_THREAD:
-        dataset_hex = await __thread_dataset_hex(config.network.thread)
-        arguments.append(f"--thread-dataset-hex {dataset_hex}")
+        if pairing_mode == DutPairingModeEnum.BLE_THREAD:
+            dataset_hex = await __thread_dataset_hex(config.network.thread)
+            arguments.append(f"--thread-dataset-hex {dataset_hex}")
 
     # Retrieve arguments from test_parameters
     if test_parameters:

From 3a31d0661e288e59e03519641f92c3acd41dd55d Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:53:29 -0800
Subject: [PATCH 09/19] Update
 test_collections/matter/sdk_tests/support/python_testing/__init__.py

Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
---
 .../matter/sdk_tests/support/python_testing/__init__.py     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/python_testing/__init__.py b/test_collections/matter/sdk_tests/support/python_testing/__init__.py
index 85b5ca8e..6ffac78f 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/__init__.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/__init__.py
@@ -34,6 +34,6 @@
         sdk_mandatory_python_test_collection()
     )
 
-    custom_python_collection: Optional[TestCollectionDeclaration] = (
-        custom_python_test_collection()
-    )
+    custom_python_collection: Optional[
+        TestCollectionDeclaration
+    ] = custom_python_test_collection()

From 2b2c6b38e727a9de9d83bcf707cb58a0adcccea5 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Thu, 19 Dec 2024 22:12:33 +0000
Subject: [PATCH 10/19] Revert changes to
 test_collections/matter/sdk_tests/support/performance_tests/utils.py

---
 .../matter/sdk_tests/support/performance_tests/utils.py          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test_collections/matter/sdk_tests/support/performance_tests/utils.py b/test_collections/matter/sdk_tests/support/performance_tests/utils.py
index f457887e..1759e694 100644
--- a/test_collections/matter/sdk_tests/support/performance_tests/utils.py
+++ b/test_collections/matter/sdk_tests/support/performance_tests/utils.py
@@ -258,6 +258,7 @@ def generate_summary(
     summary_dict["test_summary_record"][
         "number_of_iterations_failed"
     ] = compute_count_state(execution_status, False)
+    summary_dict["test_summary_record"]["platform"] = "rpi"
     summary_dict["test_summary_record"]["commissioning_method"] = commissioning_method
     summary_dict["test_summary_record"]["list_of_iterations_failed"] = []
     summary_dict["test_summary_record"]["analytics_parameters"] = [

From d42f6c157c54cc88b439898503e7315dbd2a8dd2 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Thu, 19 Dec 2024 22:16:03 +0000
Subject: [PATCH 11/19] Restyle test_environment_config.py

---
 test_collections/matter/test_environment_config.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test_collections/matter/test_environment_config.py b/test_collections/matter/test_environment_config.py
index 786877ca..76a01ba0 100644
--- a/test_collections/matter/test_environment_config.py
+++ b/test_collections/matter/test_environment_config.py
@@ -102,7 +102,8 @@ def validate_model(self, dict_model: dict) -> None:
                         f" {valid_properties}"
                     )
 
-            # All DutConfig fields but chip_timeout and enhanced_setup_flow are mandatory
+            # All DutConfig fields but chip_timeout and enhanced_setup_flow are
+            # mandatory
             mandatory_fields = valid_properties.copy()
             mandatory_fields.remove("chip_timeout")
             mandatory_fields.remove("enhanced_setup_flow")

From d567a1bb3a96f020d9cbea55f304f0ce67fcea32 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Thu, 19 Dec 2024 22:50:26 +0000
Subject: [PATCH 12/19] test: Add in-test-commissioning-method parameter for
 manual commissioning validation

Add new parameter to control commissioning flow during tests, allowing manual
validation of the commissioning process instead of auto-commissioning. This
enables test cases to verify terms and conditions acknowledgements during the
commissioning flow.

- Add in-test-commissioning-method parameter to test flags
- Support manual commissioning flow validation
- Enable testing of T&C acknowledgement scenarios
---
 .../matter/sdk_tests/support/tests/python_tests/test_utils.py    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test_collections/matter/sdk_tests/support/tests/python_tests/test_utils.py b/test_collections/matter/sdk_tests/support/tests/python_tests/test_utils.py
index ea62144e..e88f350b 100644
--- a/test_collections/matter/sdk_tests/support/tests/python_tests/test_utils.py
+++ b/test_collections/matter/sdk_tests/support/tests/python_tests/test_utils.py
@@ -333,6 +333,7 @@ async def test_generate_command_arguments_omit_comissioning_method() -> None:
 
     assert [
         "--trace-to json:log",
+        "--in-test-commissioning-method on-network",
         "--discriminator 456",
         "--passcode 8765",
     ] == arguments

From 0f0fc83da14a453ad3c78c15376e9dc168e7f3e6 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Fri, 20 Dec 2024 22:07:27 +0000
Subject: [PATCH 13/19] Add new field "enhanced_setup_flow" to exception
 message

---
 app/tests/api/api_v1/test_projects.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/tests/api/api_v1/test_projects.py b/app/tests/api/api_v1/test_projects.py
index 0bdf054b..4df348c6 100644
--- a/app/tests/api/api_v1/test_projects.py
+++ b/app/tests/api/api_v1/test_projects.py
@@ -113,7 +113,7 @@ def test_create_project_invalid_dut_config(client: TestClient) -> None:
             "detail": "The informed configuration has one or more invalid properties. "
             "Exception message: The field invalid_arg is not a valid dut_config "
             "configuration: ['discriminator', 'setup_code', 'pairing_mode', "
-            "'chip_timeout', 'chip_use_paa_certs', 'trace_log']"
+            "'chip_timeout', 'chip_use_paa_certs', 'trace_log', 'enhanced_setup_flow']"
         },
         expected_keys=["detail"],
     )
@@ -217,7 +217,7 @@ def test_update_project_invalid_dut_config(client: TestClient, db: Session) -> N
             "detail": "The informed configuration has one or more invalid properties. "
             "Exception message: The field invalid_arg is not a valid dut_config "
             "configuration: ['discriminator', 'setup_code', 'pairing_mode', "
-            "'chip_timeout', 'chip_use_paa_certs', 'trace_log']"
+            "'chip_timeout', 'chip_use_paa_certs', 'trace_log', 'enhanced_setup_flow']"
         },
         expected_keys=["detail"],
     )

From 2cd99b7fde26e2d676a55c0b135d2618e89eda52 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Fri, 20 Dec 2024 22:58:34 +0000
Subject: [PATCH 14/19] Cherry-pick test_python_parser.py from origin/main

---
 .../tests/python_tests/test_python_parser.py  | 153 ++++++++++++++++--
 1 file changed, 141 insertions(+), 12 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py b/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
index d2110d43..8c709cef 100644
--- a/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
+++ b/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
@@ -20,19 +20,148 @@
 
 from ...python_testing.models.python_test_parser import parse_python_script
 
+sample_single_test_python_file_content = """
+class TC_Sample(MatterBaseTest):
 
-def test_python_file_parser() -> None:
-    file_path = Path(
-        "/app/backend/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_script/python_tests_info.json"
-    )
+    def desc_TC_Sample(self) -> str:
+        return "Sample TC Description"
 
-    tests = parse_python_script(file_path)
+    def steps_TC_Sample(self) -> list[TestStep]:
+        steps = [
+            TestStep(1, "Commissioning, already done", is_commissioning=True),
+            TestStep(2, "Second step"),
+            TestStep(3, "Third step"),
+        ]
+        return steps
 
-    assert len(tests) == 4
-    assert "sdk/TC_Commissioning_Sample" == str(tests[0].path)
-    assert len(tests[0].steps) == 3
-    assert tests[0].description == "Commissioning Sample TC Description"
+    def test_TC_Sample(self):
+        print("Test execution")
+    
+    def pics_TC_Sample(self):
+        pics =  ["MCORE.ROLE.COMMISSIONEE"]
+
+"""
+
+sample_multi_tests_single_class_python_file_content = """
+class TC_CommonSample(MatterBaseTest):
+
+    def steps_TC_Sample_1_1(self) -> list[TestStep]:
+        steps = [
+            TestStep(1, "Commissioning, already done", is_commissioning=True),
+            TestStep(2, "Second step"),
+            TestStep(3, "Third step"),
+        ]
+        return steps
+
+    def test_TC_ABC_1_1(self):
+        print("Test execution")
+
+    def test_TC_Sample_1_1(self):
+        print("Test execution")
+
+    def test_TC_Sample_1_2(self):
+        print("Test execution")
+
+"""
+
+sample_multi_tests_multi_classes_python_file_content = """
+class TC_CommonSample(MatterBaseTest):
+
+    def steps_TC_Sample_1_1(self) -> list[TestStep]:
+        steps = [
+            TestStep(1, "Commissioning, already done", is_commissioning=True),
+            TestStep(2, "Second step"),
+            TestStep(3, "Third step"),
+        ]
+        return steps
+
+    def test_TC_ABC_1_1(self):
+        print("Test execution")
+
+    def test_TC_Sample_1_1(self):
+        print("Test execution")
+
+    def test_TC_Sample_1_2(self):
+        print("Test execution")
+
+class TC_CommonSample_2(MatterBaseTest):
+
+    def test_TC_ABC_1_2(self):
+        print("Test execution")
+
+    def test_TC_DEF_1_3(self):
+        print("Test execution")
+
+"""
+
+
+def test_single_test_python_file_parser() -> None:
+    file_path = Path("/test/TC_Sample.py")
+
+    # We mock builtin `open` method to read sample python file content,
+    # to avoid having to load a real file.
+    with mock.patch(
+        "test_collections.matter.sdk_tests.support.python_testing.models.python_test_parser."
+        "open",
+        new=mock.mock_open(read_data=sample_single_test_python_file_content),
+    ) as file_open:
+        tests = parse_python_script(file_path)
+
+    file_open.assert_called_once_with(file_path, "r")
+
+    assert len(tests) is 1
+    assert all(test.path == file_path for test in tests)
+    assert len(tests[0].steps) is 3
+    assert tests[0].description == "Sample TC Description"
     assert "MCORE.ROLE.COMMISSIONEE" in tests[0].PICS
-    assert len(tests[0].PICS) == 2
-    count = sum(1 for test in tests if str(test.path) == "sdk/TC_SameClass")
-    assert count == 2
+    assert len(tests[0].PICS) is 1
+
+
+def test_multi_tests_single_class_python_file_parser() -> None:
+    file_path = Path("/test/TC_Sample.py")
+
+    # We mock builtin `open` method to read sample python file content,
+    # to avoid having to load a real file.
+    with mock.patch(
+        "test_collections.matter.sdk_tests.support.python_testing.models.python_test_parser."
+        "open",
+        new=mock.mock_open(
+            read_data=sample_multi_tests_single_class_python_file_content
+        ),
+    ) as file_open:
+        tests = parse_python_script(file_path)
+
+    file_open.assert_called_once_with(file_path, "r")
+
+    assert len(tests) is 3
+    assert all(test.path == file_path for test in tests)
+    test_names = [test.name for test in tests]
+    assert "TC_ABC_1_1" in test_names
+    assert "TC_Sample_1_1" in test_names
+    assert "TC_Sample_1_2" in test_names
+
+
+def test_multi_tests_multi_classes_python_file_parser() -> None:
+    file_path = Path("/test/TC_Sample.py")
+
+    # We mock builtin `open` method to read sample python file content,
+    # to avoid having to load a real file.
+    with mock.patch(
+        "test_collections.matter.sdk_tests.support.python_testing.models.python_test_parser."
+        "open",
+        new=mock.mock_open(
+            read_data=sample_multi_tests_multi_classes_python_file_content
+        ),
+    ) as file_open:
+        tests = parse_python_script(file_path)
+
+    file_open.assert_called_once_with(file_path, "r")
+
+    assert len(tests) is 5
+    assert all(test.path == file_path for test in tests)
+    test_names = [test.name for test in tests]
+    assert "TC_ABC_1_1" in test_names
+    assert "TC_Sample_1_1" in test_names
+    assert "TC_Sample_1_2" in test_names
+    assert "TC_ABC_1_2" in test_names
+    assert "TC_DEF_1_3" in test_names

From 5d65ce5c4fd8d8e6d67cad68ceea52b999f1dacd Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Fri, 20 Dec 2024 23:31:07 +0000
Subject: [PATCH 15/19] Cherry-pick python_test_parser.py from origin/main

---
 .../models/python_test_parser.py              | 109 +++++-------------
 1 file changed, 29 insertions(+), 80 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py b/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py
index bee3e364..715a8ee6 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py
@@ -14,7 +14,6 @@
 # limitations under the License.
 #
 import ast
-import json
 import re
 from pathlib import Path
 from typing import Any, List, Optional, Union
@@ -37,7 +36,6 @@
     "TC_IDM_10_2",
     "TC_IDM_10_3",
     "TC_IDM_10_4",
-    "TC_IDM_10_5",
     "TC_IDM_12_1",
 ]
 
@@ -60,71 +58,20 @@ def parse_python_script(path: Path) -> list[PythonTest]:
     Example: file TC_ACE_1_3.py has the methods test_TC_ACE_1_3, desc_TC_ACE_1_3,
         pics_TC_ACE_1_3 and steps_TC_ACE_1_3.
     """
-    python_tests: list[PythonTest] = []
-
-    with open(path, "r") as json_file:
-        parsed_scripts = json.load(json_file)
-
-    if len(parsed_scripts) == 0:
-        return python_tests
-
-    for script_info in parsed_scripts["tests"]:
-        test_function = script_info["function"]
-        test_name = __test_case_name(test_function)
-        if test_name is None:
-            logger.info(f"Failed to parse test name [{test_function}].")
-            continue
-
-        test_description = script_info["desc"]
-        test_pics = script_info["pics"]
-        test_path = script_info["path"]
-        test_class_name = script_info["class_name"]
-        parsed_steps = script_info["steps"]
-
-        is_commssioning = False
-        test_steps: list[MatterTestStep] = []
-        for index, step in enumerate(parsed_steps):
-            step_description = step["description"]
-
-            if index == 0:
-                is_commssioning = step["is_commissioning"]
-
-            test_steps.append(
-                MatterTestStep(
-                    label=step_description,
-                    is_commissioning=is_commssioning,
-                )
-            )
+    with open(path, "r") as python_file:
+        parsed_python_file = ast.parse(python_file.read())
 
-        # - PythonTestType.MANDATORY: Mandatory test cases
-        # - PythonTestType.LEGACY: Tests that have only one step and with this
-        #   name: "Run entire test"
-        # - PythonTestType.COMMISSIONING: Test cases flagged as commissioning
-        # - PythonTestType.NO_COMMISSIONING: Test cases flagged as no commissioning
-        if test_name in mandatory_python_tcs_public_id:
-            python_test_type = PythonTestType.MANDATORY
-        elif len(test_steps) == 1 and test_steps[0].label == "Run entire test":
-            python_test_type = PythonTestType.LEGACY
-        elif is_commssioning:
-            python_test_type = PythonTestType.COMMISSIONING
-        else:
-            python_test_type = PythonTestType.NO_COMMISSIONING
-
-        python_tests.append(
-            PythonTest(
-                name=test_name,
-                description=test_description,
-                steps=test_steps,
-                config={},  # Currently config is not configured in Python Testing
-                PICS=test_pics,
-                path=test_path,
-                type=MatterTestType.AUTOMATED,
-                class_name=test_class_name,
-                python_test_type=python_test_type,
-            )
-        )
+    test_classes = __test_classes(parsed_python_file)
+
+    test_cases: list[PythonTest] = []
+    for c in test_classes:
+        test_methods = __test_methods(c)
+        test_names = __test_case_names(test_methods)
+
+        for test_name in test_names:
+            test_cases.append(__parse_test_case(test_name, test_methods, c.name, path))
 
-    return python_tests
+    return test_cases
 
 
 def __test_classes(module: ast.Module) -> list[ast.ClassDef]:
@@ -175,20 +122,24 @@ def __test_methods(class_def: ast.ClassDef) -> list[FunctionDefType]:
     return all_methods
 
 
-def __test_case_name(function_name: str) -> Optional[str]:
-    """Extract test case name from methods that match the pattern "test_TC_[\\S]+".
+def __test_case_names(methods: list[FunctionDefType]) -> list[str]:
+    """Extract test case names from methods that match the pattern "test_TC_[\\S]+".
 
     Args:
-        methods (str): Function name.
+        methods (list[FunctionDefType]): List of methods to search from.
 
     Returns:
-        str: Test case name.
+        list[str]: List of test case names.
     """
-    if match := re.match(TC_TEST_FUNCTION_PATTERN, function_name):
-        if name := match["title"]:
-            return name
+    test_names: list[str] = []
 
-    return None
+    for m in methods:
+        if isinstance(m.name, str):
+            if match := re.match(TC_TEST_FUNCTION_PATTERN, m.name):
+                if name := match["title"]:
+                    test_names.append(name)
+
+    return test_names
 
 
 def __parse_test_case(
@@ -210,8 +161,8 @@ def __parse_test_case(
         try:
             tc_desc = __retrieve_description(desc_method)
         except Exception as e:
-            logger.warning(
-                f"Failed parsing description method for {tc_name}, Error:{str(e)}"
+            logger.error(
+                f"Error while parsing description for {tc_name}, Error:{str(e)}"
             )
 
     # If the python test does not implement the steps template method,
@@ -222,14 +173,14 @@ def __parse_test_case(
         try:
             tc_steps = __retrieve_steps(steps_method)
         except Exception as e:
-            logger.warning(f"Failed parsing steps method for {tc_name}, Error:{str(e)}")
+            logger.error(f"Error while parsing steps for {tc_name}, Error:{str(e)}")
 
     pics_method = __get_method_by_name(pics_method_name, methods)
     if pics_method:
         try:
             tc_pics = __retrieve_pics(pics_method)
         except Exception as e:
-            logger.warning(f"Failed parsing PICS method for {tc_name}, Error:{str(e)}")
+            logger.error(f"Error while parsing PICS for {tc_name}, Error:{str(e)}")
 
     # - PythonTestType.COMMISSIONING: test cases that have a commissioning first step
     # - PythonTestType.NO_COMMISSIONING: test cases that follow the expected template
@@ -289,9 +240,7 @@ def __retrieve_steps(method: FunctionDefType) -> List[MatterTestStep]:
             step_name = step.args[ARG_STEP_DESCRIPTION_INDEX].value
             parsed_step_name = step_name
         except Exception as e:
-            logger.warning(
-                f"Failed parsing step name from {method.name}, Error:{str(e)}"
-            )
+            logger.error(f"Error while parsing step from {method.name}, Error:{str(e)}")
             parsed_step_name = "UNABLE TO PARSE TEST STEP NAME"
 
         python_steps.append(

From ff8943b923a588f34bbcede5df8ed32ebbe4afa9 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Fri, 20 Dec 2024 23:36:16 +0000
Subject: [PATCH 16/19] Revert "Cherry-pick python_test_parser.py from
 origin/main"

This reverts commit 5d65ce5c4fd8d8e6d67cad68ceea52b999f1dacd.
---
 .../models/python_test_parser.py              | 109 +++++++++++++-----
 1 file changed, 80 insertions(+), 29 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py b/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py
index 715a8ee6..bee3e364 100644
--- a/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py
+++ b/test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 #
 import ast
+import json
 import re
 from pathlib import Path
 from typing import Any, List, Optional, Union
@@ -36,6 +37,7 @@
     "TC_IDM_10_2",
     "TC_IDM_10_3",
     "TC_IDM_10_4",
+    "TC_IDM_10_5",
     "TC_IDM_12_1",
 ]
 
@@ -58,20 +60,71 @@ def parse_python_script(path: Path) -> list[PythonTest]:
     Example: file TC_ACE_1_3.py has the methods test_TC_ACE_1_3, desc_TC_ACE_1_3,
         pics_TC_ACE_1_3 and steps_TC_ACE_1_3.
     """
-    with open(path, "r") as python_file:
-        parsed_python_file = ast.parse(python_file.read())
-
-    test_classes = __test_classes(parsed_python_file)
-
-    test_cases: list[PythonTest] = []
-    for c in test_classes:
-        test_methods = __test_methods(c)
-        test_names = __test_case_names(test_methods)
+    python_tests: list[PythonTest] = []
+
+    with open(path, "r") as json_file:
+        parsed_scripts = json.load(json_file)
+
+    if len(parsed_scripts) == 0:
+        return python_tests
+
+    for script_info in parsed_scripts["tests"]:
+        test_function = script_info["function"]
+        test_name = __test_case_name(test_function)
+        if test_name is None:
+            logger.info(f"Failed to parse test name [{test_function}].")
+            continue
+
+        test_description = script_info["desc"]
+        test_pics = script_info["pics"]
+        test_path = script_info["path"]
+        test_class_name = script_info["class_name"]
+        parsed_steps = script_info["steps"]
+
+        is_commssioning = False
+        test_steps: list[MatterTestStep] = []
+        for index, step in enumerate(parsed_steps):
+            step_description = step["description"]
+
+            if index == 0:
+                is_commssioning = step["is_commissioning"]
+
+            test_steps.append(
+                MatterTestStep(
+                    label=step_description,
+                    is_commissioning=is_commssioning,
+                )
+            )
 
-        for test_name in test_names:
-            test_cases.append(__parse_test_case(test_name, test_methods, c.name, path))
+        # - PythonTestType.MANDATORY: Mandatory test cases
+        # - PythonTestType.LEGACY: Tests that have only one step and with this
+        #   name: "Run entire test"
+        # - PythonTestType.COMMISSIONING: Test cases flagged as commissioning
+        # - PythonTestType.NO_COMMISSIONING: Test cases flagged as no commissioning
+        if test_name in mandatory_python_tcs_public_id:
+            python_test_type = PythonTestType.MANDATORY
+        elif len(test_steps) == 1 and test_steps[0].label == "Run entire test":
+            python_test_type = PythonTestType.LEGACY
+        elif is_commssioning:
+            python_test_type = PythonTestType.COMMISSIONING
+        else:
+            python_test_type = PythonTestType.NO_COMMISSIONING
+
+        python_tests.append(
+            PythonTest(
+                name=test_name,
+                description=test_description,
+                steps=test_steps,
+                config={},  # Currently config is not configured in Python Testing
+                PICS=test_pics,
+                path=test_path,
+                type=MatterTestType.AUTOMATED,
+                class_name=test_class_name,
+                python_test_type=python_test_type,
+            )
+        )
 
-    return test_cases
+    return python_tests
 
 
 def __test_classes(module: ast.Module) -> list[ast.ClassDef]:
@@ -122,24 +175,20 @@ def __test_methods(class_def: ast.ClassDef) -> list[FunctionDefType]:
     return all_methods
 
 
-def __test_case_names(methods: list[FunctionDefType]) -> list[str]:
-    """Extract test case names from methods that match the pattern "test_TC_[\\S]+".
+def __test_case_name(function_name: str) -> Optional[str]:
+    """Extract test case name from methods that match the pattern "test_TC_[\\S]+".
 
     Args:
-        methods (list[FunctionDefType]): List of methods to search from.
+        methods (str): Function name.
 
     Returns:
-        list[str]: List of test case names.
+        str: Test case name.
     """
-    test_names: list[str] = []
+    if match := re.match(TC_TEST_FUNCTION_PATTERN, function_name):
+        if name := match["title"]:
+            return name
 
-    for m in methods:
-        if isinstance(m.name, str):
-            if match := re.match(TC_TEST_FUNCTION_PATTERN, m.name):
-                if name := match["title"]:
-                    test_names.append(name)
-
-    return test_names
+    return None
 
 
 def __parse_test_case(
@@ -161,8 +210,8 @@ def __parse_test_case(
         try:
             tc_desc = __retrieve_description(desc_method)
         except Exception as e:
-            logger.error(
-                f"Error while parsing description for {tc_name}, Error:{str(e)}"
+            logger.warning(
+                f"Failed parsing description method for {tc_name}, Error:{str(e)}"
             )
 
     # If the python test does not implement the steps template method,
@@ -173,14 +222,14 @@ def __parse_test_case(
         try:
             tc_steps = __retrieve_steps(steps_method)
         except Exception as e:
-            logger.error(f"Error while parsing steps for {tc_name}, Error:{str(e)}")
+            logger.warning(f"Failed parsing steps method for {tc_name}, Error:{str(e)}")
 
     pics_method = __get_method_by_name(pics_method_name, methods)
     if pics_method:
         try:
             tc_pics = __retrieve_pics(pics_method)
         except Exception as e:
-            logger.error(f"Error while parsing PICS for {tc_name}, Error:{str(e)}")
+            logger.warning(f"Failed parsing PICS method for {tc_name}, Error:{str(e)}")
 
     # - PythonTestType.COMMISSIONING: test cases that have a commissioning first step
     # - PythonTestType.NO_COMMISSIONING: test cases that follow the expected template
@@ -240,7 +289,9 @@ def __retrieve_steps(method: FunctionDefType) -> List[MatterTestStep]:
             step_name = step.args[ARG_STEP_DESCRIPTION_INDEX].value
             parsed_step_name = step_name
         except Exception as e:
-            logger.error(f"Error while parsing step from {method.name}, Error:{str(e)}")
+            logger.warning(
+                f"Failed parsing step name from {method.name}, Error:{str(e)}"
+            )
             parsed_step_name = "UNABLE TO PARSE TEST STEP NAME"
 
         python_steps.append(

From f17722d2da2e4945dd0e6b52de84462b854f26bc Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Fri, 20 Dec 2024 23:36:19 +0000
Subject: [PATCH 17/19] Revert "Cherry-pick test_python_parser.py from
 origin/main"

This reverts commit 2cd99b7fde26e2d676a55c0b135d2618e89eda52.
---
 .../tests/python_tests/test_python_parser.py  | 153 ++----------------
 1 file changed, 12 insertions(+), 141 deletions(-)

diff --git a/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py b/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
index 8c709cef..d2110d43 100644
--- a/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
+++ b/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
@@ -20,148 +20,19 @@
 
 from ...python_testing.models.python_test_parser import parse_python_script
 
-sample_single_test_python_file_content = """
-class TC_Sample(MatterBaseTest):
 
-    def desc_TC_Sample(self) -> str:
-        return "Sample TC Description"
+def test_python_file_parser() -> None:
+    file_path = Path(
+        "/app/backend/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_script/python_tests_info.json"
+    )
 
-    def steps_TC_Sample(self) -> list[TestStep]:
-        steps = [
-            TestStep(1, "Commissioning, already done", is_commissioning=True),
-            TestStep(2, "Second step"),
-            TestStep(3, "Third step"),
-        ]
-        return steps
+    tests = parse_python_script(file_path)
 
-    def test_TC_Sample(self):
-        print("Test execution")
-    
-    def pics_TC_Sample(self):
-        pics =  ["MCORE.ROLE.COMMISSIONEE"]
-
-"""
-
-sample_multi_tests_single_class_python_file_content = """
-class TC_CommonSample(MatterBaseTest):
-
-    def steps_TC_Sample_1_1(self) -> list[TestStep]:
-        steps = [
-            TestStep(1, "Commissioning, already done", is_commissioning=True),
-            TestStep(2, "Second step"),
-            TestStep(3, "Third step"),
-        ]
-        return steps
-
-    def test_TC_ABC_1_1(self):
-        print("Test execution")
-
-    def test_TC_Sample_1_1(self):
-        print("Test execution")
-
-    def test_TC_Sample_1_2(self):
-        print("Test execution")
-
-"""
-
-sample_multi_tests_multi_classes_python_file_content = """
-class TC_CommonSample(MatterBaseTest):
-
-    def steps_TC_Sample_1_1(self) -> list[TestStep]:
-        steps = [
-            TestStep(1, "Commissioning, already done", is_commissioning=True),
-            TestStep(2, "Second step"),
-            TestStep(3, "Third step"),
-        ]
-        return steps
-
-    def test_TC_ABC_1_1(self):
-        print("Test execution")
-
-    def test_TC_Sample_1_1(self):
-        print("Test execution")
-
-    def test_TC_Sample_1_2(self):
-        print("Test execution")
-
-class TC_CommonSample_2(MatterBaseTest):
-
-    def test_TC_ABC_1_2(self):
-        print("Test execution")
-
-    def test_TC_DEF_1_3(self):
-        print("Test execution")
-
-"""
-
-
-def test_single_test_python_file_parser() -> None:
-    file_path = Path("/test/TC_Sample.py")
-
-    # We mock builtin `open` method to read sample python file content,
-    # to avoid having to load a real file.
-    with mock.patch(
-        "test_collections.matter.sdk_tests.support.python_testing.models.python_test_parser."
-        "open",
-        new=mock.mock_open(read_data=sample_single_test_python_file_content),
-    ) as file_open:
-        tests = parse_python_script(file_path)
-
-    file_open.assert_called_once_with(file_path, "r")
-
-    assert len(tests) is 1
-    assert all(test.path == file_path for test in tests)
-    assert len(tests[0].steps) is 3
-    assert tests[0].description == "Sample TC Description"
+    assert len(tests) == 4
+    assert "sdk/TC_Commissioning_Sample" == str(tests[0].path)
+    assert len(tests[0].steps) == 3
+    assert tests[0].description == "Commissioning Sample TC Description"
     assert "MCORE.ROLE.COMMISSIONEE" in tests[0].PICS
-    assert len(tests[0].PICS) is 1
-
-
-def test_multi_tests_single_class_python_file_parser() -> None:
-    file_path = Path("/test/TC_Sample.py")
-
-    # We mock builtin `open` method to read sample python file content,
-    # to avoid having to load a real file.
-    with mock.patch(
-        "test_collections.matter.sdk_tests.support.python_testing.models.python_test_parser."
-        "open",
-        new=mock.mock_open(
-            read_data=sample_multi_tests_single_class_python_file_content
-        ),
-    ) as file_open:
-        tests = parse_python_script(file_path)
-
-    file_open.assert_called_once_with(file_path, "r")
-
-    assert len(tests) is 3
-    assert all(test.path == file_path for test in tests)
-    test_names = [test.name for test in tests]
-    assert "TC_ABC_1_1" in test_names
-    assert "TC_Sample_1_1" in test_names
-    assert "TC_Sample_1_2" in test_names
-
-
-def test_multi_tests_multi_classes_python_file_parser() -> None:
-    file_path = Path("/test/TC_Sample.py")
-
-    # We mock builtin `open` method to read sample python file content,
-    # to avoid having to load a real file.
-    with mock.patch(
-        "test_collections.matter.sdk_tests.support.python_testing.models.python_test_parser."
-        "open",
-        new=mock.mock_open(
-            read_data=sample_multi_tests_multi_classes_python_file_content
-        ),
-    ) as file_open:
-        tests = parse_python_script(file_path)
-
-    file_open.assert_called_once_with(file_path, "r")
-
-    assert len(tests) is 5
-    assert all(test.path == file_path for test in tests)
-    test_names = [test.name for test in tests]
-    assert "TC_ABC_1_1" in test_names
-    assert "TC_Sample_1_1" in test_names
-    assert "TC_Sample_1_2" in test_names
-    assert "TC_ABC_1_2" in test_names
-    assert "TC_DEF_1_3" in test_names
+    assert len(tests[0].PICS) == 2
+    count = sum(1 for test in tests if str(test.path) == "sdk/TC_SameClass")
+    assert count == 2

From 48c0e323bdaf8b07ba1b6e9dcd1ea24955ad2a05 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Fri, 20 Dec 2024 23:36:57 +0000
Subject: [PATCH 18/19] Removed broken test `test_python_parser.py`

---
 .../tests/python_tests/test_python_parser.py  | 38 -------------------
 1 file changed, 38 deletions(-)
 delete mode 100644 test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py

diff --git a/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py b/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
deleted file mode 100644
index d2110d43..00000000
--- a/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright (c) 2023 Project CHIP Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# flake8: noqa
-# Ignore flake8 check for this file
-from pathlib import Path
-from unittest import mock
-
-from ...python_testing.models.python_test_parser import parse_python_script
-
-
-def test_python_file_parser() -> None:
-    file_path = Path(
-        "/app/backend/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_script/python_tests_info.json"
-    )
-
-    tests = parse_python_script(file_path)
-
-    assert len(tests) == 4
-    assert "sdk/TC_Commissioning_Sample" == str(tests[0].path)
-    assert len(tests[0].steps) == 3
-    assert tests[0].description == "Commissioning Sample TC Description"
-    assert "MCORE.ROLE.COMMISSIONEE" in tests[0].PICS
-    assert len(tests[0].PICS) == 2
-    count = sum(1 for test in tests if str(test.path) == "sdk/TC_SameClass")
-    assert count == 2

From 8b8989457e6fa6ba810aacf479eb0576130e9e44 Mon Sep 17 00:00:00 2001
From: James Swan <122404367+swan-amazon@users.noreply.github.com>
Date: Sat, 21 Dec 2024 05:03:56 +0000
Subject: [PATCH 19/19] Revert "Removed broken test `test_python_parser.py`"

This reverts commit 48c0e323bdaf8b07ba1b6e9dcd1ea24955ad2a05.
---
 .../tests/python_tests/test_python_parser.py  | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py

diff --git a/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py b/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
new file mode 100644
index 00000000..d2110d43
--- /dev/null
+++ b/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_parser.py
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2023 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# flake8: noqa
+# Ignore flake8 check for this file
+from pathlib import Path
+from unittest import mock
+
+from ...python_testing.models.python_test_parser import parse_python_script
+
+
+def test_python_file_parser() -> None:
+    file_path = Path(
+        "/app/backend/test_collections/matter/sdk_tests/support/tests/python_tests/test_python_script/python_tests_info.json"
+    )
+
+    tests = parse_python_script(file_path)
+
+    assert len(tests) == 4
+    assert "sdk/TC_Commissioning_Sample" == str(tests[0].path)
+    assert len(tests[0].steps) == 3
+    assert tests[0].description == "Commissioning Sample TC Description"
+    assert "MCORE.ROLE.COMMISSIONEE" in tests[0].PICS
+    assert len(tests[0].PICS) == 2
+    count = sum(1 for test in tests if str(test.path) == "sdk/TC_SameClass")
+    assert count == 2