Skip to content

Commit f6ce7cc

Browse files
Refactoring of the matter testing infrastructure
1 parent b5ff347 commit f6ce7cc

File tree

189 files changed

+379
-359
lines changed

Some content is hidden

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

189 files changed

+379
-359
lines changed

BUILD.gn

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
6969
"//examples/common/pigweed/rpc_console/py:chip_rpc",
7070
"//integrations/mobly:chip_mobly",
7171
"//scripts/py_matter_yamltests:matter_yamltests",
72-
"//src/python_testing/matter_testing_infrastructure:metadata_parser",
72+
"//src/python_testing/matter_testing_infrastructure:testing_support",
7373
]
7474

7575
pw_python_venv("matter_build_venv") {
@@ -110,7 +110,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
110110
deps = [
111111
"${chip_root}/scripts:matter_yamltests_distribution.wheel",
112112
"${chip_root}/src/controller/python:chip-repl",
113-
"${chip_root}/src/python_testing/matter_testing_infrastructure:metadata_parser.wheel",
113+
"${chip_root}/src/python_testing/matter_testing_infrastructure:testing_support.wheel",
114114
]
115115
if (enable_pylib) {
116116
deps += [ "${chip_root}/src/pybindings/pycontroller" ]
@@ -239,7 +239,7 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
239239
"//scripts/py_matter_idl:matter_idl.tests",
240240
"//scripts/py_matter_yamltests:matter_yamltests.tests",
241241
"//src:tests_run",
242-
"//src/python_testing/matter_testing_infrastructure:metadata_parser.tests",
242+
"//src/python_testing/matter_testing_infrastructure:testing_support.tests",
243243
]
244244

245245
if (current_os == "linux" || current_os == "mac") {

docs/testing/python.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Python tests located in src/python_testing
2525
section should include various parameters and their respective values,
2626
which will guide the test runner on how to execute the tests.
2727
- All test classes inherit from `MatterBaseTest` in
28-
[matter_testing_support.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py)
28+
[matter_testing.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_infrastructure/testing_support/matter_testing.py)
2929
- Support for commissioning using the python controller
3030
- Default controller (`self.default_controller`) of type `ChipDeviceCtrl`
3131
- `MatterBaseTest` inherits from the Mobly BaseTestClass
@@ -38,7 +38,7 @@ Python tests located in src/python_testing
3838
decorated with the @async_test_body decorator
3939
- Use `ChipDeviceCtrl` to interact with the DUT
4040
- Controller API is in `ChipDeviceCtrl.py` (see API doc in file)
41-
- Some support methods in `matter_testing_support.py`
41+
- Some support methods in `matter_testing.py`
4242
- Use Mobly assertions for failing tests
4343
- `self.step()` along with a `steps_*` method to mark test plan steps for cert
4444
tests
@@ -372,7 +372,7 @@ pai = await dev_ctrl.SendCommand(nodeid, 0, Clusters.OperationalCredentials.Comm
372372
## Mobly helpers
373373

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

378378
- `default_matter_test_main`
@@ -499,11 +499,11 @@ Fabric admin for default controller:
499499

500500
## Other support utilities
501501

502-
- `basic_composition_support`
502+
- `basic_composition`
503503
- wildcard read, whole device analysis
504504
- `CommissioningFlowBlocks`
505505
- various commissioning support for core tests
506-
- `spec_parsing_support`
506+
- `spec_parsing`
507507
- parsing data model XML into python readable format
508508

509509
# Running tests locally

scripts/build_python.sh

+73-73
Original file line numberDiff line numberDiff line change
@@ -80,78 +80,78 @@ file_name=${0##*/}
8080

8181
while (($#)); do
8282
case $1 in
83-
--help | -h)
84-
help
85-
exit 1
86-
;;
87-
--enable_ble | -b)
88-
enable_ble=$2
89-
if [[ "$enable_ble" != "true" && "$enable_ble" != "false" ]]; then
90-
echo "chip_detail_logging should have a true/false value, not '$enable_ble'"
91-
exit
92-
fi
93-
shift
94-
;;
95-
--chip_detail_logging | -d)
96-
chip_detail_logging=$2
97-
if [[ "$chip_detail_logging" != "true" && "$chip_detail_logging" != "false" ]]; then
98-
echo "chip_detail_logging should have a true/false value, not '$chip_detail_logging'"
99-
exit
100-
fi
101-
shift
102-
;;
103-
--chip_mdns | -m)
104-
chip_mdns=$2
105-
shift
106-
;;
107-
--enable_pybindings | -p)
108-
enable_pybindings=$2
109-
if [[ "$enable_pybindings" != "true" && "$enable_pybindings" != "false" ]]; then
110-
echo "enable_pybindings should have a true/false value, not '$enable_pybindings'"
111-
exit
112-
fi
113-
shift
114-
;;
115-
--time_between_case_retries | -t)
116-
chip_case_retry_delta=$2
117-
shift
118-
;;
119-
--install_virtual_env | -i)
120-
install_virtual_env=$2
121-
shift
122-
;;
123-
--clean_virtual_env | -c)
124-
clean_virtual_env=$2
125-
if [[ "$clean_virtual_env" != "yes" && "$clean_virtual_env" != "no" ]]; then
126-
echo "clean_virtual_env should have a yes/no value, not '$clean_virtual_env'"
127-
exit
128-
fi
129-
shift
130-
;;
131-
--include_pytest_deps)
132-
install_pytest_requirements=$2
133-
if [[ "$install_pytest_requirements" != "yes" && "$install_pytest_requirements" != "no" ]]; then
134-
echo "install_pytest_requirements should have a yes/no value, not '$install_pytest_requirements'"
135-
exit
136-
fi
137-
shift
138-
;;
139-
--extra_packages)
140-
extra_packages=$2
141-
shift
142-
;;
143-
--pregen_dir | -z)
144-
pregen_dir=$2
145-
shift
146-
;;
147-
--jupyter-lab | -j)
148-
install_jupyterlab=yes
149-
;;
150-
-*)
151-
help
152-
echo "Unknown Option \"$1\""
153-
exit 1
154-
;;
83+
--help | -h)
84+
help
85+
exit 1
86+
;;
87+
--enable_ble | -b)
88+
enable_ble=$2
89+
if [[ "$enable_ble" != "true" && "$enable_ble" != "false" ]]; then
90+
echo "chip_detail_logging should have a true/false value, not '$enable_ble'"
91+
exit
92+
fi
93+
shift
94+
;;
95+
--chip_detail_logging | -d)
96+
chip_detail_logging=$2
97+
if [[ "$chip_detail_logging" != "true" && "$chip_detail_logging" != "false" ]]; then
98+
echo "chip_detail_logging should have a true/false value, not '$chip_detail_logging'"
99+
exit
100+
fi
101+
shift
102+
;;
103+
--chip_mdns | -m)
104+
chip_mdns=$2
105+
shift
106+
;;
107+
--enable_pybindings | -p)
108+
enable_pybindings=$2
109+
if [[ "$enable_pybindings" != "true" && "$enable_pybindings" != "false" ]]; then
110+
echo "enable_pybindings should have a true/false value, not '$enable_pybindings'"
111+
exit
112+
fi
113+
shift
114+
;;
115+
--time_between_case_retries | -t)
116+
chip_case_retry_delta=$2
117+
shift
118+
;;
119+
--install_virtual_env | -i)
120+
install_virtual_env=$2
121+
shift
122+
;;
123+
--clean_virtual_env | -c)
124+
clean_virtual_env=$2
125+
if [[ "$clean_virtual_env" != "yes" && "$clean_virtual_env" != "no" ]]; then
126+
echo "clean_virtual_env should have a yes/no value, not '$clean_virtual_env'"
127+
exit
128+
fi
129+
shift
130+
;;
131+
--include_pytest_deps)
132+
install_pytest_requirements=$2
133+
if [[ "$install_pytest_requirements" != "yes" && "$install_pytest_requirements" != "no" ]]; then
134+
echo "install_pytest_requirements should have a yes/no value, not '$install_pytest_requirements'"
135+
exit
136+
fi
137+
shift
138+
;;
139+
--extra_packages)
140+
extra_packages=$2
141+
shift
142+
;;
143+
--pregen_dir | -z)
144+
pregen_dir=$2
145+
shift
146+
;;
147+
--jupyter-lab | -j)
148+
install_jupyterlab=yes
149+
;;
150+
-*)
151+
help
152+
echo "Unknown Option \"$1\""
153+
exit 1
154+
;;
155155
esac
156156
shift
157157
done
@@ -213,7 +213,7 @@ else
213213
fi
214214

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

218218
if [ -n "$extra_packages" ]; then
219219
WHEEL+=("$extra_packages")

scripts/spec_xml/generate_spec_xml.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def dump_cluster_ids(output_dir):
202202
clusters_output_dir = os.path.abspath(
203203
os.path.join(output_dir, 'clusters'))
204204

205-
from spec_parsing_support import build_xml_clusters
205+
from testing_support.spec_parsing import build_xml_clusters
206206

207207
header = '# List of currently defined spec clusters\n'
208208
header += 'This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.py`. DO NOT EDIT BY HAND!\n\n'

scripts/tests/run_python_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import click
3333
import coloredlogs
3434
from colorama import Fore, Style
35-
from metadata_parser.metadata import Metadata, MetadataReader
35+
from testing_support.metadata import Metadata, MetadataReader
3636

3737
DEFAULT_CHIP_ROOT = os.path.abspath(
3838
os.path.join(os.path.dirname(__file__), '..', '..'))

src/python_testing/MinimalRepresentation.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from dataclasses import dataclass, field
1919

2020
from chip.tlv import uint
21-
from conformance_support import ConformanceDecision
22-
from global_attribute_ids import GlobalAttributeIds
23-
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
21+
from testing_support.conformance import ConformanceDecision
22+
from testing_support.global_attribute_ids import GlobalAttributeIds
23+
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
2424
from TC_DeviceConformance import DeviceConformanceTests
2525

2626

src/python_testing/TCP_Tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import chip.clusters as Clusters
2727
from chip import ChipDeviceCtrl
2828
from chip.interaction_model import InteractionModelError
29-
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
29+
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
3030
from mobly import asserts
3131

3232

src/python_testing/TC_ACE_1_2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from chip.clusters.Attribute import EventReadResult, SubscriptionTransaction, TypedAttributePath
3636
from chip.exceptions import ChipStackError
3737
from chip.interaction_model import Status
38-
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
38+
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
3939
from mobly import asserts
4040

4141

src/python_testing/TC_ACE_1_3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import chip.clusters as Clusters
3333
from chip.interaction_model import Status
34-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
34+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
3535
from mobly import asserts
3636

3737

src/python_testing/TC_ACE_1_4.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import chip.clusters as Clusters
3333
from chip.interaction_model import Status
34-
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
34+
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
3535
from mobly import asserts
3636

3737
# This test requires several additional command line arguments

src/python_testing/TC_ACE_1_5.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import chip.clusters as Clusters
3333
from chip import ChipDeviceCtrl
3434
from chip.interaction_model import Status
35-
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
35+
from testing_support.matter_testing import MatterBaseTest, async_test_body, default_matter_test_main
3636
from mobly import asserts
3737

3838

src/python_testing/TC_ACL_2_2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717
import chip.clusters as Clusters
18-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
18+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
1919
from mobly import asserts
2020

2121

src/python_testing/TC_AccessChecker.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
from typing import Optional
1717

1818
import chip.clusters as Clusters
19-
from basic_composition_support import BasicCompositionTests
19+
from testing_support.basic_composition import BasicCompositionTests
2020
from chip.interaction_model import Status
2121
from chip.tlv import uint
22-
from global_attribute_ids import GlobalAttributeIds
23-
from matter_testing_support import (AttributePathLocation, ClusterPathLocation, MatterBaseTest, TestStep, async_test_body,
24-
default_matter_test_main)
25-
from spec_parsing_support import XmlCluster, build_xml_clusters
22+
from testing_support.global_attribute_ids import GlobalAttributeIds
23+
from testing_support.matter_testing import (AttributePathLocation, ClusterPathLocation, MatterBaseTest, TestStep, async_test_body,
24+
default_matter_test_main)
25+
from testing_support.spec_parsing import XmlCluster, build_xml_clusters
2626

2727

2828
class AccessTestType(Enum):

src/python_testing/TC_BOOLCFG_2_1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from operator import ior
2121

2222
import chip.clusters as Clusters
23-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
23+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
2424
from mobly import asserts
2525

2626

src/python_testing/TC_BOOLCFG_3_1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import chip.clusters as Clusters
2222
from chip.interaction_model import Status
23-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
23+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
2424
from mobly import asserts
2525

2626

src/python_testing/TC_BOOLCFG_4_1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import logging
1919

2020
import chip.clusters as Clusters
21-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
21+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
2222
from mobly import asserts
2323

2424

src/python_testing/TC_BOOLCFG_4_2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import chip.clusters as Clusters
2121
from chip.interaction_model import InteractionModelError, Status
22-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
22+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
2323
from mobly import asserts
2424

2525
sensorTrigger = 0x0080_0000_0000_0000

src/python_testing/TC_BOOLCFG_4_3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import chip.clusters as Clusters
2121
from chip.interaction_model import InteractionModelError, Status
22-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
22+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
2323
from mobly import asserts
2424

2525
sensorTrigger = 0x0080_0000_0000_0000

src/python_testing/TC_BOOLCFG_4_4.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import chip.clusters as Clusters
2121
from chip.interaction_model import InteractionModelError, Status
22-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
22+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
2323
from mobly import asserts
2424

2525
sensorTrigger = 0x0080_0000_0000_0000

src/python_testing/TC_BOOLCFG_5_1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import chip.clusters as Clusters
2121
from chip.interaction_model import InteractionModelError, Status
22-
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
22+
from testing_support.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
2323
from mobly import asserts
2424

2525
sensorTrigger = 0x0080_0000_0000_0000

0 commit comments

Comments
 (0)