|
23 | 23 | import pathlib
|
24 | 24 | import sys
|
25 | 25 | import typing
|
26 |
| -from pprint import pprint |
| 26 | +from pprint import pformat, pprint |
27 | 27 | from typing import Any, Optional
|
28 | 28 |
|
29 | 29 | import chip.clusters.ClusterObjects
|
@@ -105,15 +105,20 @@ async def connect_over_pase(self, dev_ctrl):
|
105 | 105 | asserts.assert_equal(len(setupCode), 1, "Require one of either --qr-code or --manual-code.")
|
106 | 106 | await dev_ctrl.FindOrEstablishPASESession(setupCode[0], self.dut_node_id)
|
107 | 107 |
|
108 |
| - def dump_wildcard(self, dump_device_composition_path: typing.Optional[str]): |
| 108 | + def dump_wildcard(self, dump_device_composition_path: typing.Optional[str]) -> tuple[str, str]: |
| 109 | + """ Dumps a json and a txt file of the attribute wildcard for this device if the dump_device_composition_path is supplied. |
| 110 | + Returns the json and txt as strings. |
| 111 | + """ |
109 | 112 | node_dump_dict = {endpoint_id: MatterTlvToJson(self.endpoints_tlv[endpoint_id]) for endpoint_id in self.endpoints_tlv}
|
110 |
| - logging.debug(f"Raw TLV contents of Node: {json.dumps(node_dump_dict, indent=2)}") |
| 113 | + json_dump_string = json.dumps(node_dump_dict, indent=2) |
| 114 | + logging.debug(f"Raw TLV contents of Node: {json_dump_string}") |
111 | 115 |
|
112 | 116 | if dump_device_composition_path is not None:
|
113 | 117 | with open(pathlib.Path(dump_device_composition_path).with_suffix(".json"), "wt+") as outfile:
|
114 | 118 | json.dump(node_dump_dict, outfile, indent=2)
|
115 | 119 | with open(pathlib.Path(dump_device_composition_path).with_suffix(".txt"), "wt+") as outfile:
|
116 | 120 | pprint(self.endpoints, outfile, indent=1, width=200, compact=True)
|
| 121 | + return (json_dump_string, pformat(self.endpoints, indent=1, width=200, compact=True)) |
117 | 122 |
|
118 | 123 | async def setup_class_helper(self, default_to_pase: bool = True):
|
119 | 124 | dev_ctrl = self.default_controller
|
|
0 commit comments