Skip to content

Commit

Permalink
Merge 2e99385 into 9efb599
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsalghelani-csa authored Aug 7, 2024
2 parents 9efb599 + 2e99385 commit 1086188
Show file tree
Hide file tree
Showing 189 changed files with 297 additions and 282 deletions.
6 changes: 3 additions & 3 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
"//examples/common/pigweed/rpc_console/py:chip_rpc",
"//integrations/mobly:chip_mobly",
"//scripts/py_matter_yamltests:matter_yamltests",
"//src/python_testing/matter_testing_infrastructure:metadata_parser",
"//src/python_testing/matter_testing_infrastructure:testing_support",
]

pw_python_venv("matter_build_venv") {
Expand Down Expand Up @@ -110,7 +110,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
deps = [
"${chip_root}/scripts:matter_yamltests_distribution.wheel",
"${chip_root}/src/controller/python:chip-repl",
"${chip_root}/src/python_testing/matter_testing_infrastructure:metadata_parser.wheel",
"${chip_root}/src/python_testing/matter_testing_infrastructure:testing_support.wheel",
]
if (enable_pylib) {
deps += [ "${chip_root}/src/pybindings/pycontroller" ]
Expand Down Expand Up @@ -239,7 +239,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
"//scripts/py_matter_idl:matter_idl.tests",
"//scripts/py_matter_yamltests:matter_yamltests.tests",
"//src:tests_run",
"//src/python_testing/matter_testing_infrastructure:metadata_parser.tests",
"//src/python_testing/matter_testing_infrastructure:testing_support.tests",
]

if (current_os == "linux" || current_os == "mac") {
Expand Down
10 changes: 5 additions & 5 deletions docs/testing/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Python tests located in src/python_testing
section should include various parameters and their respective values,
which will guide the test runner on how to execute the tests.
- All test classes inherit from `MatterBaseTest` in
[matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py)
[matter_testing.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_infrastructure/testing_support/matter_testing.py)
- Support for commissioning using the python controller
- Default controller (`self.default_controller`) of type `ChipDeviceCtrl`
- `MatterBaseTest` inherits from the Mobly BaseTestClass
Expand All @@ -38,7 +38,7 @@ Python tests located in src/python_testing
decorated with the @async_test_body decorator
- Use `ChipDeviceCtrl` to interact with the DUT
- Controller API is in `ChipDeviceCtrl.py` (see API doc in file)
- Some support methods in `matter_testing_support.py`
- Some support methods in `matter_testing.py`
- Use Mobly assertions for failing tests
- `self.step()` along with a `steps_*` method to mark test plan steps for cert
tests
Expand Down Expand Up @@ -372,7 +372,7 @@ pai = await dev_ctrl.SendCommand(nodeid, 0, Clusters.OperationalCredentials.Comm
## Mobly helpers

The test system is based on Mobly, and the
[matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py)
[matter_testing.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_infrastructure/testing_support/matter_testing.py)
class provides some helpers for Mobly integration.

- `default_matter_test_main`
Expand Down Expand Up @@ -499,11 +499,11 @@ Fabric admin for default controller:

## Other support utilities

- `basic_composition_support`
- `basic_composition`
- wildcard read, whole device analysis
- `CommissioningFlowBlocks`
- various commissioning support for core tests
- `spec_parsing_support`
- `spec_parsing`
- parsing data model XML into python readable format

# Running tests locally
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ else
fi

# Add the matter_testing_infrastructure wheel
WHEEL+=("$OUTPUT_ROOT"/python/obj/src/python_testing/matter_testing_infrastructure/metadata_parser._build_wheel/metadata_parser-*.whl)
WHEEL+=("$OUTPUT_ROOT"/python/obj/src/python_testing/matter_testing_infrastructure/testing_support._build_wheel/testing_support-*.whl)

if [ -n "$extra_packages" ]; then
WHEEL+=("$extra_packages")
Expand Down
2 changes: 1 addition & 1 deletion scripts/spec_xml/generate_spec_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def dump_cluster_ids(output_dir):
clusters_output_dir = os.path.abspath(
os.path.join(output_dir, 'clusters'))

from spec_parsing_support import build_xml_clusters
from testing_support.spec_parsing import build_xml_clusters

header = '# List of currently defined spec clusters\n'
header += 'This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.py`. DO NOT EDIT BY HAND!\n\n'
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/run_python_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import click
import coloredlogs
from colorama import Fore, Style
from metadata_parser.metadata import Metadata, MetadataReader
from testing_support.metadata import Metadata, MetadataReader

DEFAULT_CHIP_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..'))
Expand Down
6 changes: 3 additions & 3 deletions src/python_testing/MinimalRepresentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
from dataclasses import dataclass, field

from chip.tlv import uint
from conformance_support import ConformanceDecision
from global_attribute_ids import GlobalAttributeIds
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from testing_support.conformance import ConformanceDecision
from testing_support.global_attribute_ids import GlobalAttributeIds
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
from TC_DeviceConformance import DeviceConformanceTests


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TCP_Tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import chip.clusters as Clusters
from chip import ChipDeviceCtrl
from chip.interaction_model import InteractionModelError
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_ACE_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction, TypedAttributePath
from chip.exceptions import ChipStackError
from chip.interaction_model import Status
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_ACE_1_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import chip.clusters as Clusters
from chip.interaction_model import Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_ACE_1_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

import chip.clusters as Clusters
from chip.interaction_model import Status
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts

# This test requires several additional command line arguments
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_ACE_1_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import chip.clusters as Clusters
from chip import ChipDeviceCtrl
from chip.interaction_model import Status
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_ACL_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# === END CI TEST ARGUMENTS ===

import chip.clusters as Clusters
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
10 changes: 5 additions & 5 deletions src/python_testing/TC_AccessChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
from typing import Optional

import chip.clusters as Clusters
from basic_composition_support import BasicCompositionTests
from testing_support.basic_composition import BasicCompositionTests
from chip.interaction_model import Status
from chip.tlv import uint
from global_attribute_ids import GlobalAttributeIds
from matter_testing_support import (AttributePathLocation, ClusterPathLocation, MatterBaseTest, TestStep, async_test_body,
default_matter_test_main)
from spec_parsing_support import XmlCluster, build_xml_clusters
from testing_support.global_attribute_ids import GlobalAttributeIds
from testing_support.matter_testing import (AttributePathLocation, ClusterPathLocation, MatterBaseTest, TestStep, async_test_body,
default_matter_test_main)
from testing_support.spec_parsing import XmlCluster, build_xml_clusters


class AccessTestType(Enum):
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from operator import ior

import chip.clusters as Clusters
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_3_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import chip.clusters as Clusters
from chip.interaction_model import Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_4_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import logging

import chip.clusters as Clusters
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_4_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import chip.clusters as Clusters
from chip.interaction_model import InteractionModelError, Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

sensorTrigger = 0x0080_0000_0000_0000
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_4_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import chip.clusters as Clusters
from chip.interaction_model import InteractionModelError, Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

sensorTrigger = 0x0080_0000_0000_0000
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_4_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import chip.clusters as Clusters
from chip.interaction_model import InteractionModelError, Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

sensorTrigger = 0x0080_0000_0000_0000
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_5_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import chip.clusters as Clusters
from chip.interaction_model import InteractionModelError, Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

sensorTrigger = 0x0080_0000_0000_0000
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_5_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import chip.clusters as Clusters
from chip.interaction_model import InteractionModelError, Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

sensorTrigger = 0x0080_0000_0000_0000
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BRBINFO_4_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import chip.clusters as Clusters
from chip import ChipDeviceCtrl
from matter_testing_support import MatterBaseTest, SimpleEventCallback, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, SimpleEventCallback, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_CADMIN_1_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from chip import ChipDeviceCtrl
from chip.ChipDeviceCtrl import CommissioningParameters
from chip.exceptions import ChipStackError
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_CCTRL_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

import chip.clusters as Clusters
from matter_testing_support import MatterBaseTest, TestStep, default_matter_test_main, has_cluster, per_endpoint_test
from testing_support.matter_testing import MatterBaseTest, TestStep, default_matter_test_main, has_cluster, per_endpoint_test
from mobly import asserts


Expand Down
4 changes: 2 additions & 2 deletions src/python_testing/TC_CCTRL_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import chip.clusters as Clusters
from chip import ChipDeviceCtrl
from chip.interaction_model import InteractionModelError, Status
from matter_testing_support import (MatterBaseTest, TestStep, async_test_body, default_matter_test_main, has_cluster,
per_endpoint_test)
from testing_support.matter_testing import (MatterBaseTest, TestStep, async_test_body, default_matter_test_main, has_cluster,
per_endpoint_test)
from mobly import asserts


Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_CC_10_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import chip.clusters as Clusters
from chip.interaction_model import Status
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

kCCAttributeValueIDs = [0x0001, 0x0003, 0x0004, 0x0007, 0x4000, 0x4001, 0x4002, 0x4003, 0x4004]
Expand Down
10 changes: 6 additions & 4 deletions src/python_testing/TC_CC_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

import chip.clusters as Clusters
from chip.clusters import ClusterObjects as ClusterObjects
from matter_testing_support import (ClusterAttributeChangeAccumulator, MatterBaseTest, TestStep, default_matter_test_main,
has_cluster, per_endpoint_test)
from testing_support.matter_testing import (ClusterAttributeChangeAccumulator, MatterBaseTest, TestStep, default_matter_test_main,
has_cluster, per_endpoint_test)
from mobly import asserts
from test_plan_support import commission_if_required, if_feature_supported, read_attribute, verify_success

Expand Down Expand Up @@ -65,11 +65,13 @@ def entry_count_verification() -> str:
5, f"If OnOff cluster is present in _ServerList_, {THcommand} On command on OnOff cluster", verify_success()),
TestStep(
6, f'{if_feature_supported("HS")}, {THcommand} MoveHue with _MoveMode_ field set to Down, _Rate_ field set to 255 and remaining fields set to 0', verify_success()),
TestStep(7, f'{if_feature_supported("HS")}, {THcommand} MoveSaturation with _MoveMode_ field set to Down, _Rate_ field set to 255 and remaining fields set to 0', verify_success()),
TestStep(7, f'{if_feature_supported("HS")}, {
THcommand} MoveSaturation with _MoveMode_ field set to Down, _Rate_ field set to 255 and remaining fields set to 0', verify_success()),
TestStep(8, 'Set up a subscription wildcard subscription for the Color Control Cluster, with MinIntervalFloor set to 0, MaxIntervalCeiling set to 30 and KeepSubscriptions set to false',
'Subscription successfully established'),
TestStep(9, 'If the HS feature is not supported, skip step 10 to 15'),
TestStep(10, f'{THcommand} MoveToHue with _Hue_ field set to 254, _TransitionTime_ field set to 100, _Direction_ field set to Shortest and remaining fields set to 0', verify_success()),
TestStep(10, f'{
THcommand} MoveToHue with _Hue_ field set to 254, _TransitionTime_ field set to 100, _Direction_ field set to Shortest and remaining fields set to 0', verify_success()),
TestStep(11, store_values('CurrentHue')),
TestStep(12, verify_entry_count('CurrentHue'), entry_count_verification()),
TestStep(
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_CGEN_2_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from chip import ChipDeviceCtrl
from chip.ChipDeviceCtrl import CommissioningParameters
from chip.exceptions import ChipStackError
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts

# Commissioning stage numbers - we should find a better way to match these to the C++ code
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_CNET_1_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import logging

import chip.clusters as Clusters
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts

kRootEndpointId = 0
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_CNET_4_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import chip.clusters as Clusters
from chip.clusters.Types import NullValue
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches
from mobly import asserts


Expand Down
4 changes: 2 additions & 2 deletions src/python_testing/TC_DA_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import re

import chip.clusters as Clusters
from basic_composition_support import BasicCompositionTests
from testing_support.basic_composition import BasicCompositionTests
from chip.interaction_model import InteractionModelError, Status
from chip.tlv import TLVReader
from cryptography import x509
Expand All @@ -41,7 +41,7 @@
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec, utils
from ecdsa.curves import curve_by_name
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, hex_from_bytes, type_matches
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, hex_from_bytes, type_matches
from mobly import asserts
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.error import PyAsn1Error
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_DA_1_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec, utils
from ecdsa.curves import curve_by_name
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, hex_from_bytes, type_matches
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main, hex_from_bytes, type_matches
from mobly import asserts
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.error import PyAsn1Error
Expand Down
4 changes: 2 additions & 2 deletions src/python_testing/TC_DA_1_7.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from cryptography.x509 import AuthorityKeyIdentifier, Certificate, SubjectKeyIdentifier, load_der_x509_certificate
from matter_testing_support import (MatterBaseTest, TestStep, async_test_body, bytes_from_hex, default_matter_test_main,
hex_from_bytes)
from testing_support.matter_testing import (MatterBaseTest, TestStep, async_test_body, bytes_from_hex, default_matter_test_main,
hex_from_bytes)
from mobly import asserts

# Those are SDK samples that are known to be non-production.
Expand Down
Loading

0 comments on commit 1086188

Please sign in to comment.