Skip to content

Commit 4080775

Browse files
cecillerestyled-commits
andauthoredMar 4, 2024
Docs: Add python testing documentation (project-chip#31996)
* check * Docs: Add python documentation Taken from the tutorial session presented at the Geneva member meeting, available here: https://groups.csa-iot.org/wg/matter-csg/document/32281 * fix a couple of todos * Fix spelling in API documentation * Fix reference * remove braces * Restyled by prettier-markdown * Restyled by shellharden * Exclude python docs from spelling These are both covered by the other spell checker and include so many camel cased words that it's going to pollute the spelling list excessively. * Fix spelling, add words to wordlist * more spelling * Restyled by prettier-markdown --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 62e5102 commit 4080775

File tree

6 files changed

+1623
-17
lines changed

6 files changed

+1623
-17
lines changed
 

‎.github/.wordlist.txt

+7
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ EchoMessage
465465
EchoRequests
466466
EchoResponse
467467
EchoService
468+
ECW
468469
edaf
469470
edc
470471
EDR
@@ -738,6 +739,7 @@ kCase
738739
Kconfig
739740
kDacPublicKey
740741
KeypadInput
742+
keypair
741743
keyset
742744
kGroup
743745
kInvalidCommandId
@@ -884,6 +886,7 @@ mlan
884886
MLD
885887
mmevk
886888
moal
889+
Mobly
887890
ModeSelect
888891
modprobe
889892
Modustoolbox
@@ -948,6 +951,7 @@ nrfdks
948951
nrfutil
949952
nrfxlib
950953
NTAG
954+
NTP
951955
nullable
952956
nullptr
953957
NUM
@@ -1013,6 +1017,7 @@ OTBR
10131017
otcli
10141018
outform
10151019
outgoingCommands
1020+
overridable
10161021
OxygenConcentrationMeasurement
10171022
OzoneConcentrationMeasurement
10181023
PAA
@@ -1051,6 +1056,7 @@ perfetto
10511056
periodicQueryTimeout
10521057
pexpect
10531058
pickString
1059+
PICSCODE
10541060
PID
10551061
Pigweed
10561062
PinCode
@@ -1366,6 +1372,7 @@ TestGenExample
13661372
TestGroupDemoConfig
13671373
TestMultiRead
13681374
TestName
1375+
TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke
13691376
TESTPASSWD
13701377
TestPICS
13711378
TESTSSID

‎.spellcheck.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ matrix:
6565
# converts markdown to HTML
6666
- pyspelling.filters.markdown:
6767
sources:
68-
- '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md'
68+
- '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md | !docs/testing/python.md | !docs/testing/ChipDeviceCtrlAPI.md'
6969
aspell:
7070
ignore-case: true
7171
camel-case: true

‎docs/testing/ChipDeviceCtrlAPI.md

+1,079
Large diffs are not rendered by default.
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
18+
19+
pydoc-markdown -m chip.ChipDeviceCtrl '{
20+
renderer: {
21+
type: markdown,
22+
descriptive_class_title: false,
23+
render_toc: true,
24+
insert_header_anchors: true
25+
}
26+
}' >"$SCRIPT_DIR"/ChipDeviceCtrlAPI.md

‎docs/testing/python.md

+497-3
Large diffs are not rendered by default.

‎src/controller/python/chip/ChipDeviceCtrl.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def __rich_repr__(self):
174174
class DeviceProxyWrapper():
175175
''' Encapsulates a pointer to OperationalDeviceProxy on the c++ side that needs to be
176176
freed when DeviceProxyWrapper goes out of scope. There is a potential issue where
177-
if this is copied around that a double free will occure, but how this is used today
177+
if this is copied around that a double free will occur, but how this is used today
178178
that is not an issue that needs to be accounted for and it will become very apparent
179179
if that happens.
180180
'''
@@ -923,15 +923,15 @@ async def SendCommand(self, nodeid: int, endpoint: int, payload: ClusterObjects.
923923
suppressResponse: typing.Union[None, bool] = None):
924924
'''
925925
Send a cluster-object encapsulated command to a node and get returned a future that can be awaited upon to receive
926-
the response. If a valid responseType is passed in, that will be used to deserialize the object. If not,
926+
the response. If a valid responseType is passed in, that will be used to de-serialize the object. If not,
927927
the type will be automatically deduced from the metadata received over the wire.
928928
929929
timedWriteTimeoutMs: Timeout for a timed invoke request. Omit or set to 'None' to indicate a non-timed request.
930930
interactionTimeoutMs: Overall timeout for the interaction. Omit or set to 'None' to have the SDK automatically compute the
931931
right timeout value based on transport characteristics as well as the responsiveness of the target.
932932
933933
Returns:
934-
- command respone. The type of the response is defined by the command.
934+
- command response. The type of the response is defined by the command.
935935
Raises:
936936
- InteractionModelError on error
937937
'''
@@ -956,7 +956,7 @@ async def SendBatchCommands(self, nodeid: int, commands: typing.List[ClusterComm
956956
suppressResponse: typing.Optional[bool] = None):
957957
'''
958958
Send a batch of cluster-object encapsulated commands to a node and get returned a future that can be awaited upon to receive
959-
the responses. If a valid responseType is passed in, that will be used to deserialize the object. If not,
959+
the responses. If a valid responseType is passed in, that will be used to de-serialize the object. If not,
960960
the type will be automatically deduced from the metadata received over the wire.
961961
962962
nodeId: Target's Node ID
@@ -1024,7 +1024,7 @@ async def WriteAttribute(self, nodeid: int,
10241024
to the XYZ attribute on the test cluster to endpoint 1
10251025
10261026
Returns:
1027-
- [AttributeStatus] (list - one for each pth)
1027+
- [AttributeStatus] (list - one for each path)
10281028
'''
10291029
self.CheckIsActive()
10301030

@@ -1321,17 +1321,17 @@ async def ReadAttribute(self, nodeid: int, attributes: typing.List[typing.Union[
13211321
To get notified on attribute change use SetAttributeUpdateCallback on the returned
13221322
SubscriptionTransaction. This is used to set a callback function, which is a callable of
13231323
type Callable[[TypedAttributePath, SubscriptionTransaction], None]
1324-
Get the attribute value from the change path using GetAttribute on the SubscriptionTransasction
1324+
Get the attribute value from the change path using GetAttribute on the SubscriptionTransaction
13251325
You can await changes in the main loop using a trigger mechanism from the callback.
13261326
ex. queue.SimpleQueue
13271327
1328-
- read request: AsyncReadTransation.ReadResponse.attributes.
1328+
- read request: AsyncReadTransaction.ReadResponse.attributes.
13291329
This is of type AttributeCache.attributeCache (Attribute.py),
13301330
which is a dict mapping endpoints to a list of Cluster (ClusterObjects.py) classes
13311331
(dict[int, List[Cluster]])
1332-
Access as ret[endpoint_id][<Cluster class>][<Attribute class>]
1333-
Ex. To access the OnTime attribute from the OnOff cluster on EP 1
1334-
ret[1][Clusters.OnOff][Clusters.OnOff.Attributes.OnTime]
1332+
Access as returned_object[endpoint_id][<Cluster class>][<Attribute class>]
1333+
Ex. To access the OnTime attribute from the OnOff cluster on endpoint 1
1334+
returned_object[1][Clusters.OnOff][Clusters.OnOff.Attributes.OnTime]
13351335
13361336
Raises:
13371337
- InteractionModelError (chip.interaction_model) on error
@@ -1399,7 +1399,7 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[
13991399
Callable[[EventReadResult, SubscriptionTransaction], None]
14001400
You can await events using a trigger mechanism in the callback. ex. queue.SimpleQueue
14011401
1402-
- read request: AsyncReadTransation.ReadResponse.events.
1402+
- read request: AsyncReadTransaction.ReadResponse.events.
14031403
This is a List[ClusterEvent].
14041404
14051405
Raises:
@@ -1878,7 +1878,7 @@ def SetDefaultNTP(self, defaultNTP: str):
18781878
).raise_on_error()
18791879

18801880
def SetTrustedTimeSource(self, nodeId: int, endpoint: int):
1881-
''' Set the trusetd time source nodeId to set during commissioning. This must be a node on the commissioner fabric.'''
1881+
''' Set the trusted time source nodeId to set during commissioning. This must be a node on the commissioner fabric.'''
18821882
self.CheckIsActive()
18831883
self._ChipStack.Call(
18841884
lambda: self._dmLib.pychip_DeviceController_SetTrustedTimeSource(nodeId, endpoint)
@@ -1993,7 +1993,7 @@ class BareChipDeviceController(ChipDeviceControllerBase):
19931993

19941994
def __init__(self, operationalKey: p256keypair.P256Keypair, noc: bytes,
19951995
icac: typing.Union[bytes, None], rcac: bytes, ipk: typing.Union[bytes, None], adminVendorId: int, name: str = None):
1996-
'''Creates a controller without autocommissioner.
1996+
'''Creates a controller without AutoCommissioner.
19971997
19981998
The allocated controller uses the noc, icac, rcac and ipk instead of the default,
19991999
random generated certificates / keys. Which is suitable for creating a controller

0 commit comments

Comments
 (0)
Please sign in to comment.