dummy_serial: A dummy/mock implementation of a serial port for testing purposes.
This Python file was changed (committed) at $Date: 2012-08-26 16:14:30 +0200 (Sun, 26 Aug 2012) $, which was $Revision: 155 $.
Set this to True for printing the communication, and also details on the port initialization.
A dictionary of respones from the dummy serial port.
The key is the message (string) sent to the dummy serial port, and the item is the response (string) from the dummy serial port.
Intended to be monkey-patched in the calling test module.
Response when no matching message (key) is found in the look-up dictionary.
Might be monkey-patched in the calling test module.
Dummy (mock) serial port for testing purposes.
Mimics the behavior of a serial port as defined by the pySerial module.
Note: As the portname argument not is used, only one port on dummy_serial can be used simultaneously.
Write to a port on dummy_serial.
Note that for Python2, the inputdata should be a string. For Python3 it should be of type bytes.
Read from a port on dummy_serial.
The response is dependent on what was written last to the port on dummy_serial, and what is defined in the RESPONSES dictionary.
Returns a string for Python2 and bytes for Python3.