Skip to content

Commit 1ce1146

Browse files
Move non certiication tests (#39730)
* Moved Test*py files without test_TC_* into src/python_testing/test_testing * Updated affected paths by moving Test*py files * Updated import references. Moved files into test_testing * Updated doc path * Fix import * Fix import path * Restore files to required path. Updated doc from files. Updated import references. * Moved DeviceConformanceTests class into its own file to importly from src/python_testing and src/python_testing/test_testing * Restyled by isort * fix: fix import paths * isort fix * Refactor class DefaultChecker into its own file on test_testing as is a dependency for two Tests * Fix class name issue caused by Vscode * Fix import path * Restyled by isort * Fix import path * Fixes issues from merge. Paths updated and imports fixed * Fix import from chip to matter * Restyled by isort * Fix import from chip to matter * Fix a issue when mergin files. Method check_root_node_restricted_clusters was outside the class DeviceConformanceTests * Fix path --------- Co-authored-by: Restyled.io <[email protected]>
1 parent 67ad6e0 commit 1ce1146

28 files changed

+664
-620
lines changed

.github/workflows/tests.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -846,17 +846,17 @@ jobs:
846846
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/test_TC_ICDM_2_1_min_pics.py'
847847
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/test_TC_SC_7_1.py'
848848
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestDecorators.py'
849-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestChoiceConformanceSupport.py'
850-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestConformanceSupport.py'
851-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestConformanceTest.py'
852-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestDefaultWarnings.py'
853-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestIdChecks.py'
854-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestMatterTestingSupport.py'
855-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestPics.py'
856-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestSpecParsingDeviceType.py'
857-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestSpecParsingNamespace.py'
858-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestSpecParsingSelection.py'
859-
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/TestSpecParsingSupport.py'
849+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestChoiceConformanceSupport.py'
850+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestConformanceSupport.py'
851+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestConformanceTest.py'
852+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestDefaultWarnings.py'
853+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestIdChecks.py'
854+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestMatterTestingSupport.py'
855+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestPics.py'
856+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestSpecParsingDeviceType.py'
857+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestSpecParsingNamespace.py'
858+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestSpecParsingSelection.py'
859+
scripts/run_in_python_env.sh out/venv 'python3 src/python_testing/test_testing/TestSpecParsingSupport.py'
860860
scripts/run_in_python_env.sh out/venv 'PYTHONPATH=src/python_testing:$PYTHONPATH python3 -m unittest discover -s src/python_testing/mdns_discovery/tests -p "test_*.py"'
861861
862862
- name: Run Tests

scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
'linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test',
3131
'chip-all-clusters-app')
3232
DEFAULT_TEST_RUNNER = os.path.join(DEFAULT_CHIP_ROOT, 'scripts', 'tests', 'run_python_test.py')
33-
DEFAULT_TEST_SCRIPT = os.path.join(DEFAULT_CHIP_ROOT, 'src', 'python_testing', 'TestTimeSyncTrustedTimeSource.py')
33+
DEFAULT_TEST_SCRIPT = os.path.join(DEFAULT_CHIP_ROOT, 'src', 'python_testing', 'test_testing', 'TestTimeSyncTrustedTimeSource.py')
3434

3535

3636
class TestDriver:

src/python_testing/TC_DefaultWarnings.py

Lines changed: 3 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -34,127 +34,12 @@
3434
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
3535
# === END CI TEST ARGUMENTS ===
3636

37-
from typing import Optional
38-
3937
from mobly import asserts
38+
from test_testing.DefaultChecker import (FLAG_DEFAULT_CALENDAR_FORMAT, FLAG_FAULT_INJECTION, FLAG_FIXED_LABEL_DEFAULT_VALUES,
39+
FLAG_FIXED_LABEL_EMPTY, FLAG_PRODUCT_NAME, FLAG_SAMPLE_MEI, FLAG_UNIT_TESTING,
40+
FLAG_VENDOR_ID, FLAG_VENDOR_NAME, DefaultChecker)
4041

41-
import matter.clusters as Clusters
42-
from matter.testing.basic_composition import BasicCompositionTests
4342
from matter.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
44-
from matter.testing.problem_notices import (AttributePathLocation, ClusterPathLocation, ProblemLocation, ProblemNotice,
45-
ProblemSeverity)
46-
47-
FLAG_PRODUCT_NAME = "pixit_allow_test_in_product_name"
48-
FLAG_VENDOR_NAME = "pixit_allow_test_in_vendor_name"
49-
FLAG_VENDOR_ID = "pixit_allow_default_vendor_id"
50-
FLAG_DEFAULT_CALENDAR_FORMAT = "pixit_allow_default_calendar_format"
51-
FLAG_UNIT_TESTING = "pixit_allow_unit_testing_cluster"
52-
FLAG_FAULT_INJECTION = "pixit_allow_fault_injection_cluster"
53-
FLAG_SAMPLE_MEI = "pixit_allow_sample_mei_cluster"
54-
FLAG_FIXED_LABEL_EMPTY = "pixit_allow_empty_fixed_label_list"
55-
FLAG_FIXED_LABEL_DEFAULT_VALUES = "pixit_allow_fixed_label_default_values"
56-
57-
58-
DEFAULT_FIXED_LABEL_VALUES = [Clusters.FixedLabel.Structs.LabelStruct(label='room', value='bedroom 2'),
59-
Clusters.FixedLabel.Structs.LabelStruct(label='orientation', value='North'),
60-
Clusters.FixedLabel.Structs.LabelStruct(label='floor', value='2'),
61-
Clusters.FixedLabel.Structs.LabelStruct(label='direction', value='up')]
62-
63-
64-
def _problem(location: ProblemLocation, msg: str):
65-
return ProblemNotice("Default Value Checker", location, ProblemSeverity.ERROR, msg)
66-
67-
68-
def warning_wrapper(override_flag: str):
69-
def warning_wrapper_internal(body):
70-
def runner(self: MatterBaseTest):
71-
skip = self.user_params.get(override_flag, False)
72-
if not skip:
73-
problem: ProblemNotice = body(self)
74-
if problem:
75-
problem.problem += f"\nIf this is intended, you may disable this check using the {override_flag}"
76-
self.problems.append(problem)
77-
else:
78-
self.mark_current_step_skipped()
79-
return runner
80-
return warning_wrapper_internal
81-
82-
83-
class DefaultChecker(BasicCompositionTests):
84-
@warning_wrapper(FLAG_PRODUCT_NAME)
85-
def check_default_product_name(self):
86-
cluster = Clusters.BasicInformation
87-
attr = cluster.Attributes.ProductName
88-
val = self.endpoints[0][cluster][attr]
89-
if "test" in val.lower():
90-
return _problem(AttributePathLocation(0, cluster.id, attr.attribute_id), f"Product name contains test ({val})")
91-
92-
@warning_wrapper(FLAG_VENDOR_NAME)
93-
def check_default_vendor_name(self):
94-
cluster = Clusters.BasicInformation
95-
attr = cluster.Attributes.VendorName
96-
val = self.endpoints[0][cluster][attr]
97-
if "test" in val.lower():
98-
return _problem(AttributePathLocation(0, cluster.id, attr.attribute_id), f"Vendor name contains test ({val})")
99-
100-
@warning_wrapper(FLAG_VENDOR_ID)
101-
def check_default_vendor_id(self):
102-
cluster = Clusters.BasicInformation
103-
attr = cluster.Attributes.VendorID
104-
val = self.endpoints[0][cluster][attr]
105-
if val == 0x0000 or val > 0xFFF0:
106-
return _problem(AttributePathLocation(0, cluster.id, attr.attribute_id), f"Vendor is not in manufacturer code range ({val})")
107-
108-
@warning_wrapper(FLAG_DEFAULT_CALENDAR_FORMAT)
109-
def check_default_calendar_format(self):
110-
cluster = Clusters.TimeFormatLocalization
111-
attr = cluster.Attributes.ActiveCalendarType
112-
if cluster in self.endpoints[0].keys() and attr in self.endpoints[0][cluster].keys():
113-
val = self.endpoints[0][cluster][attr]
114-
if val == cluster.Enums.CalendarTypeEnum.kBuddhist:
115-
return _problem(AttributePathLocation(0, cluster.id, attr.attribute_id), "Calendar format is set to default (Buddhist)")
116-
else:
117-
self.mark_current_step_skipped()
118-
119-
def _check_testing_cluster_presence(self, cluster: Clusters.ClusterObjects.Cluster) -> Optional[ProblemNotice]:
120-
for endpoint_num, endpoint in self.endpoints.items():
121-
if cluster.id in endpoint[Clusters.Descriptor][Clusters.Descriptor.Attributes.ServerList]:
122-
return _problem(ClusterPathLocation(endpoint_num, cluster.id), f"{cluster.__name__} cluster found on device.")
123-
124-
@warning_wrapper(FLAG_UNIT_TESTING)
125-
def check_unit_testing_cluster_presence(self):
126-
return self._check_testing_cluster_presence(Clusters.UnitTesting)
127-
128-
@warning_wrapper(FLAG_FAULT_INJECTION)
129-
def check_fault_injection_cluster_presence(self):
130-
return self._check_testing_cluster_presence(Clusters.FaultInjection)
131-
132-
@warning_wrapper(FLAG_SAMPLE_MEI)
133-
def check_sample_mei_cluster_presence(self):
134-
return self._check_testing_cluster_presence(Clusters.SampleMei)
135-
136-
@warning_wrapper(FLAG_FIXED_LABEL_EMPTY)
137-
def check_fixed_label_cluster_empty(self):
138-
cluster = Clusters.FixedLabel
139-
attr = cluster.Attributes.LabelList
140-
if cluster in self.endpoints[0].keys():
141-
val = self.endpoints[0][cluster][attr]
142-
if val == []:
143-
return _problem(AttributePathLocation(0, cluster.id, attr.attribute_id), "Fixed label list is empty")
144-
else:
145-
self.mark_current_step_skipped()
146-
147-
@warning_wrapper(FLAG_FIXED_LABEL_DEFAULT_VALUES)
148-
def check_fixed_label_cluster_defaults(self):
149-
cluster = Clusters.FixedLabel
150-
attr = cluster.Attributes.LabelList
151-
if cluster in self.endpoints[0].keys():
152-
label_list = self.endpoints[0][cluster][attr]
153-
154-
if any([label for label in label_list if label in DEFAULT_FIXED_LABEL_VALUES]):
155-
return _problem(AttributePathLocation(0, cluster.id, attr.attribute_id), f"Fixed label list contains default labels:\ndefaults {DEFAULT_FIXED_LABEL_VALUES}\nlist={label_list}")
156-
else:
157-
self.mark_current_step_skipped()
15843

15944

16045
class TC_DefaultChecker(MatterBaseTest, DefaultChecker):

src/python_testing/TC_DeviceBasicComposition.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
from dataclasses import dataclass
179179
from typing import Any, Callable
180180

181-
from TC_DeviceConformance import get_supersets
181+
from test_testing.DeviceConformanceTests import get_supersets
182182

183183
import matter.clusters as Clusters
184184
import matter.clusters.ClusterObjects
@@ -197,6 +197,7 @@
197197
from matter.testing.taglist_and_topology_test import (create_device_type_list_for_root, create_device_type_lists,
198198
find_tag_list_problems, find_tree_roots, flat_list_ok,
199199
get_direct_children_of_root, parts_list_problems, separate_endpoint_types)
200+
from matter.tlv import uint
200201

201202

202203
def get_vendor_id(mei: int) -> int:
@@ -354,13 +355,13 @@ def attribute_id(cls) -> int:
354355

355356
@ChipUtility.classproperty
356357
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
357-
return ClusterObjectFieldDescriptor(Type=matter.tlv.uint)
358+
return ClusterObjectFieldDescriptor(Type=uint)
358359

359360
@ChipUtility.classproperty
360361
def standard_attribute(cls) -> bool:
361362
return False
362363

363-
value: matter.tlv.uint = 0
364+
value: 'uint' = 0
364365

365366
result = await self.default_controller.Read(nodeid=self.dut_node_id, attributes=[(endpoint_id, TempAttribute)])
366367
try:

0 commit comments

Comments
 (0)