Real hardware failure: flomni.fovy=100.0 was accepted by the property, GUI, and CLI (all capped at an inclusive 100.0), but FlomniFermatScan's own ScanArgument requires fovy strictly less than 100 -- so the scan rejected it at runtime with ScanInputValidationError, only surfacing once actually run. - flomni.fovy property setter: now raises at >=100 (was >100), matching FlomniFermatScan's gt=0/lt=100. GUI/CLI max tightened 100.0 -> 99.9. - lamni_piezo_range_x/y (become LamniFermatScan's fovx/fovy, gt=0/lt=80): found the same bug class at BOTH ends while writing the regression test -- GUI/CLI min was an inclusive 0.0 (scan requires strictly >0) and max was an inclusive 80.0 (scan requires strictly <80). Tightened to 0.1-79.9 in both GUI and CLI. Property setter's large_range_scan bypass left untouched per earlier explicit instruction -- this fixes the GUI/CLI entry points, which is where the bound is actually enforced in practice. - Added test_fov_bounds_match_scan_args.py: introspects the real ScanArgument gt/ge/lt/le from FlomniFermatScan/LamniFermatScan and asserts our configured GUI/CLI ranges are strictly inside them, so this class of bug (passes every check except the one that actually runs the scan) can't silently come back for these or future fields. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0132KBoxsovfcMNRGJhS1Pbw
Getting Started with Testing using pytest
BEC is using the pytest framework. It can be installed via
pip install pytest
in your python environment.
We note that pytest is part of the optional-dependencies [dev] of the plugin package.
Introduction
Tests in this package should be stored in the tests directory.
We suggest to sort tests of different submodules, i.e. scans or devices in the respective folder structure, and to folow a naming convention of <test_module_name.py>.
It is mandatory for test files to begin with test_ for pytest to discover them.
To run all tests, navigate to the directory of the plugin from the command line, and run the command
pytest -v --random-order ./tests
Note, the python environment needs to be active.
The additional arg -v allows pytest to run in verbose mode which provides more detailed information about the tests being run.
The argument --random-order instructs pytest to run the tests in random order, which is the default in the CI pipelines.
Test examples
Writing tests can be quite specific for the given function. We recommend writing tests as isolated as possible, i.e. try to test single functions instead of full classes. A very useful class to enable isolated testing is MagicMock. In addition, we also recommend to take a look at the How-to guides from pytest.