MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _attach

Function _attach

tests/integration/test_change_driven_transforms.py:120–138  ·  view source on GitHub ↗
(api_client, device_simulator)

Source from the content-addressed store, hash-verified

118
119
120def _attach(api_client, device_simulator):
121 # Tests re-attach after loading a second project; drop any live connection
122 # first (io.connect errors when already connected) and give the simulator's
123 # watcher thread time to clear the dead client socket before reconnecting.
124 try:
125 api_client.disconnect_device()
126 time.sleep(0.6)
127 except Exception:
128 pass
129 api_client.configure_network(host="127.0.0.1", port=9000, socket_type="tcp")
130 time.sleep(0.1)
131 api_client.set_operation_mode("project")
132 try:
133 api_client.command("project.activate")
134 except Exception:
135 pass
136 time.sleep(0.2)
137 api_client.connect_device()
138 assert device_simulator.wait_for_connection(timeout=5.0)
139
140
141def _reg(api_client, name):

Callers 3

_runMethod · 0.85
test_live_toggleMethod · 0.85

Calls 6

disconnect_deviceMethod · 0.80
configure_networkMethod · 0.80
set_operation_modeMethod · 0.80
commandMethod · 0.80
connect_deviceMethod · 0.80
wait_for_connectionMethod · 0.45

Tested by

no test coverage detected