MCPcopy Create free account
hub / github.com/JSBSim-Team/jsbsim / test_input_socket

Method test_input_socket

tests/TestInputSocket.py:103–121  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

101 asyncio.run(self.run_test(2222, self.sanity_check))
102
103 def test_input_socket(self):
104 # First, extract the time step from the script file
105 tree = et.parse(self.script_path)
106 dt = float(tree.getroot().find("run").attrib["dt"])
107
108 # The aircraft c172x does not contain an <input> tag so we need
109 # to add one.
110 tree, aircraft_name, _ = CopyAircraftDef(self.script_path, self.sandbox)
111 root = tree.getroot()
112 input_tag = et.SubElement(root, "input")
113 input_tag.attrib["port"] = "1137"
114 tree.write(self.sandbox("aircraft", aircraft_name, aircraft_name + ".xml"))
115
116 self._fdm.set_aircraft_path("aircraft")
117 self._fdm.load_script(self.script_path)
118 self._fdm.run_ic()
119 self._fdm.hold()
120
121 asyncio.run(self.run_test(1137, lambda r, w: self.shell(root, dt, r, w)))
122
123 async def shell(self, root, dt, reader, writer):
124 await self.sanity_check(reader, writer)

Callers

nothing calls this directly

Calls 5

run_testMethod · 0.95
shellMethod · 0.95
CopyAircraftDefFunction · 0.90
load_scriptMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected