3535import cbor2
3636
3737from helpers import CmdRunner , compose_args
38- from _test_util import _TestCase , DataFormat
38+ from _test_util import _TestCase , DataFormat , BundleDestLoc
3939
4040OWNPATH = os .path .dirname (os .path .abspath (__file__ ))
4141LOGGER = logging .getLogger (__name__ )
@@ -141,14 +141,16 @@ def _single_test(self, testcase: Optional[_TestCase]):
141141 tx_data = testcase .input_data if (
142142 testcase .input_data_format == DataFormat .HEX ) else self ._encode (testcase .input_data )
143143
144- if (testcase .expected_output_format == DataFormat .BUNDLEARRAY ):
144+ test_sock = self ._ol_sock if testcase .bundle_dest_loc == BundleDestLoc .APPIN else self ._ul_sock
145+
146+ if testcase .expected_output_format == DataFormat .BUNDLEARRAY :
145147 expected_rx = testcase .expected_output if (
146148 testcase .expected_output == "HEX" ) else self ._encode (testcase .expected_output )
147149
148- self . _ul_sock .send (tx_data )
150+ test_sock .send (tx_data )
149151 LOGGER .debug ('waiting' )
150152
151- rx_data = self ._wait_for (self . _ul_sock )
153+ rx_data = self ._wait_for (test_sock )
152154
153155 LOGGER .info ('\n Transferred data:\n %s\n ' , binascii .hexlify (tx_data ))
154156 LOGGER .info ('\n Received data:\n %s\n ' , binascii .hexlify (rx_data ))
@@ -160,12 +162,12 @@ def _single_test(self, testcase: Optional[_TestCase]):
160162
161163 self .assertEqual (binascii .hexlify (expected_rx ), binascii .hexlify (rx_data ))
162164
163- elif ( testcase .expected_output_format == DataFormat .NONE ) :
164- self . _ul_sock .send (tx_data )
165+ elif testcase .expected_output_format == DataFormat .NONE :
166+ test_sock .send (tx_data )
165167 LOGGER .debug ('waiting' )
166168
167169 with self .assertRaises (TimeoutError ):
168- self ._wait_for (self . _ul_sock )
170+ self ._wait_for (test_sock )
169171
170172 LOGGER .info ('\n Transferred data:\n %s\n ' , binascii .hexlify (tx_data ))
171173
@@ -178,12 +180,12 @@ def _single_test(self, testcase: Optional[_TestCase]):
178180 LOGGER .debug ("\n FOUND OCCURENCE: %s" , found )
179181 self .assertNotEqual ("" , found )
180182
181- elif ( testcase .expected_output_format == DataFormat .ERR ) :
182- self . _ul_sock .send (tx_data )
183+ elif testcase .expected_output_format == DataFormat .ERR :
184+ test_sock .send (tx_data )
183185 LOGGER .debug ('waiting' )
184186
185187 with self .assertRaises (TimeoutError ):
186- self ._wait_for (self . _ul_sock )
188+ self ._wait_for (test_sock )
187189
188190 LOGGER .info ('\n Transferred data:\n %s\n ' , binascii .hexlify (tx_data ))
189191
0 commit comments