microscope.testsuite.deviceserver_test module

class microscope.testsuite.deviceserver_test.BaseTestServeDevices(methodName='runTest')[source]

Bases: unittest.case.TestCase

Handles start and termination of deviceserver.

Subclasses may overload class properties defaults as needed.

DEVICES

list of microscope.devices to initialise.

Type:list
TIMEOUT

time given for service to terminate after receiving signal to terminate.

Type:number
p

device server process.

Type:multiprocessing.Process
DEVICES = []
TIMEOUT = 5
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

class microscope.testsuite.deviceserver_test.DeviceWithPort(port, **kwargs)[source]

Bases: microscope.devices.Device

initialize()[source]

Initialize the device.

port
class microscope.testsuite.deviceserver_test.TestClashingArguments(methodName='runTest')[source]

Bases: microscope.testsuite.deviceserver_test.BaseTestServeDevices

Device server and device constructor arguments do not clash

DEVICES = [{'cls': <class 'microscope.testsuite.deviceserver_test.DeviceWithPort'>, 'host': '127.0.0.1', 'port': 8000, 'uid': None, 'conf': {'port': 7000}}]
test_port_conflict()[source]
class microscope.testsuite.deviceserver_test.TestInputCheck(methodName='runTest')[source]

Bases: microscope.testsuite.deviceserver_test.BaseTestServeDevices

test_empty_devices()[source]

Check behaviour if there are no devices.

class microscope.testsuite.deviceserver_test.TestStarting(methodName='runTest')[source]

Bases: microscope.testsuite.deviceserver_test.BaseTestServeDevices

DEVICES = [{'cls': <class 'microscope.testsuite.devices.TestCamera'>, 'host': '127.0.0.1', 'port': 8001, 'uid': None, 'conf': {'buffer_length': 0}}, {'cls': <class 'microscope.testsuite.devices.TestFilterWheel'>, 'host': '127.0.0.1', 'port': 8003, 'uid': None, 'conf': {'filters': [(0, 'GFP', 525), (1, 'RFP'), (2, 'Cy5')]}}]
test_immediate_interrupt()[source]

Check issues on SIGTERM before starting all devices

test_standard()[source]

Simplest case, start and exit, given enough time to start all devices

microscope.testsuite.deviceserver_test._serve_without_logs(*args, **kwargs)[source]

Run serve_devices without noise from the logs.

The device server redirects the logger to stderr and creates files on the current directory. There is no options to control this behaviour so we patch the logger first.