scverse / anndata

Annotated data.
http://anndata.readthedocs.io
BSD 3-Clause "New" or "Revised" License
521 stars 149 forks source link

Fix settings #1515

Closed flying-sheep closed 3 weeks ago

flying-sheep commented 3 weeks ago

This removes the class attributes and replaces them with instance attributes.

Previously, doing anything with a SettingsManager instance would modify the class.

I also modified the tests to use an instance, so .deprecate doesn’t persist after a test. Tests should be without side effects.

How to review

without whitespace changes: https://github.com/scverse/anndata/pull/1515/files?w=1

I removed the superfluous monkeypatch.scope: Monkey patches get reset at the end of each test, so unless you need to reset them before the end of the test, no need to use scopes.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.38%. Comparing base (10c0d5b) to head (8861c02).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1515 +/- ## ========================================== + Coverage 84.35% 84.38% +0.02% ========================================== Files 35 35 Lines 5690 5692 +2 ========================================== + Hits 4800 4803 +3 + Misses 890 889 -1 ``` | [Files](https://app.codecov.io/gh/scverse/anndata/pull/1515?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse) | Coverage Δ | | |---|---|---| | [src/anndata/\_settings.py](https://app.codecov.io/gh/scverse/anndata/pull/1515?src=pr&el=tree&filepath=src%2Fanndata%2F_settings.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL2FubmRhdGEvX3NldHRpbmdzLnB5) | `95.90% <100.00%> (+0.90%)` | :arrow_up: |