usb.attach(rfc).attach(wmf).attach(wmw) # .attach(ech) # If you prefer to see the raw XML as it arrives from the USB # device. comment out the above line and uncomment this line. # usb.attach(rfc).attach(ech).attach(wmf).attach(wmw) # Sending an 'initialize' message causes the RAVEn to synchronize its # XML output -- without that, it sends an arbitrary number of partial # packets and lots of nulls. (The initialize message also elicits an # "Unknown command" response, but that appears to be benign.) usb.update(commands.initialize()) # Start the reader thread syslog.syslog(syslog.LOG_INFO, 'launching reader thread') usb.start() # Send a GET_DEVICE_INFO message to get a DeviceInfo response. time.sleep(1) usb.update(commands.get_device_info()) # Should never get here... usb.thread.join() if len(sys.argv) != 1: usage(sys.argv) # here's where it all really starts... with raven_utilities.exceptions_logged(): toplevel()
def test_with_exceptions_logged(self, mock_syslog): with self.assertRaises(RuntimeError): with raven_utilities.exceptions_logged(): TestRavenUtilities.logged_fn_01() self.assertEqual(mock_syslog.call_count, 1)