DiamondLightSource / DiamondLightSource/dodal

Fix path provider persistence issues in tests

Open
#1,177 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5
Forks
13
Avg merge
3d 2h
Merged PRs (30d)
10

Description

While working on something else I noticed there were issues with persisted state for the global `PATH_PROVIDER`. I tried to add a cleanup for this but it is worth its own PR:

Something like this in `common/beamlines/beamline_utils` :

```
def clear_path_provider():
if "PATH_PROVIDER" in globals():
global PATH_PROVIDER
del PATH_PROVIDER
```
and a cleanup fixture in conftest.
```
@pytest.fixture(autouse=True)
def path_provider_cleanup():
yield
beamline_utils.clear_path_provider()
```

## Acceptance Criteria
* The tests don't rely on accidentally persisted state, and the setting of globals is explicit

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.