DiamondLightSource / DiamondLightSource/mx-bluesky

beamline device unit test fixtures in conftest.py should not be cached in ACTIVE_DEVICES

Open
#300 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.