DiamondLightSource / DiamondLightSource/mx-bluesky
beamline device unit test fixtures in conftest.py should not be cached in ACTIVE_DEVICES
Open
hyperion
- Dominant language
- Python
- Stars
- 4
- Forks
- 5
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 2
Description
currently conftest.py exposes various device fixtures which are created by calling the corresponding factory method in i03.py; this then returns the cached device created in a previous test which was stored in ACTIVE_DEVICES rather than creating a new instance.
This can lead to mocked behaviour on the devices introduced in one unit test leaking into another.
One way of ensuring this would be to `yield` the device rather than returning it and then calling `beamline_utils.clear_devices()` in the fixture method
Contributor guide
Assessment
This issue has not been assessed yet.