Testing

plesty-lib ships ready-made tests, in plesty.lib.test, that a module runs on itself. They check what every module of its kind must get right, so a module does not have to write those tests itself. None of them imports pytest: a failure raises AssertionError, which fails a pytest test and can equally be run from a plain script next to the instrument.

Which tests each module runs

Module

Without the instrument

With the instrument

device

Testing a Device: DevicePipeline, checked by gate d1

Testing on the Instrument, Testing Over the Network, Testing Devices That Share a Computer

experiment

Testing an Experiment: ExperimentPipeline, checked by gate e1

a run on the real devices

analyzer

Testing an Analyzer: AnalyzerPipeline, checked by gate a1

—

viewer

Testing a Viewer

—

A gate is one of the checks that plesty check, the checking command of plesty-sdk (PLESTY’s developer tool), runs before a module may be published. Gates d1, e1 and a1 look for the tests above in the module and run them.

The tests without the instrument run anywhere, including in CI on every push. The tests with the instrument are kept out of CI and run next to the hardware.

In this chapter

Page

Covers

Testing a Device

the standard test of a device module, against a simulated instrument

Device Test Helpers

smaller tools for testing parameters, operations, shared instruments and parameter files

Testing an Experiment

checking an experiment’s plan without instruments

Testing an Analyzer

checking an analyzer on generated inputs

Testing a Viewer

checking plots without a window

Testing on the Instrument

checking a device on its real instrument, with timings and failure statistics

Testing Over the Network

the same, through a client, the network and the device’s server

Testing Devices That Share a Computer

whether devices on one computer slow each other down

Simulation

the stand-ins for hardware these tests use