Tests: enforce configuration cleanup
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
The current test suite runs into periodic headaches when tests accidentally leave configuration options in place. This leads to unexpected settings for subsequent tests and occasionally options missing altogether ("not found" exceptions).
We should consolidate the way that the configuration is set up for tests so that this becomes impossible. Ideally, tests would need to use a context manager (`with` statement) to use the configuration at all; otherwise, if the tested code uses `beets.config`, it should encounter an error. This will force all tests to automatically tear down their configuration.
This may involve removing the implicit loading in [LazyConfig](https://github.com/sampsyo/beets/blob/master/beets/util/confit.py#L870) in favor of an explicit `materialize` call.
Contributor guide
Assessment
This issue has not been assessed yet.