Mock

This module defines several functions and classes for mocking a serial port receiving Olimex-EKG-EMG (aka. EXG) packets.

class olimex.mock.FakeSerialByteArray(data, *args, **kwargs)

A class for mocking a serial.Serial object with data from a bytearray.

read()

Return one byte.

class olimex.mock.FakeSerialFromFile(file_path, *args, **kwargs)

A class for mocking a serial.Serial object with data from a file.

read()

Return one byte.

class olimex.mock.SerialMocked(mock_data_source)

A context manager for mocking serial.Serial objects during testing.

olimex.mock.fake_serial_class_factory(mock_data_source)

Return a serial.Serial like object.

A factory for creating serial.Serial like objects. These objects can be used for testing other logic within in this package.

Parameters:mock_data_source
olimex.mock.packet_generator()

Return an EXG formatted packet that contains fake channel data.

This generator produces fake packets of the form sent by the Olimex-EKG-EMG shield.

Previous topic

GUI

Next topic

Utilities

This Page