brainglobe / brainglobe-atlasapi

A lightweight python module to interact with atlases for systems neuroscience
https://brainglobe.info/documentation/brainglobe-atlasapi/index.html
BSD 3-Clause "New" or "Revised" License
117 stars 24 forks source link

Ensure tests do not affect local system when run locally. #302

Open adamltyson opened 1 month ago

adamltyson commented 1 month ago

E.g. test_config_file.test_config_edit (see https://github.com/brainglobe/brainglobe-atlasapi/pull/300)

Comment from @alessandrofelder:

One thing maybe worth trying (that I think would be a good idea across BrainGlobe) is to monkeypatch Path.home() for all tests when not running on CI. It looks like there's a few constant variables that need to be adapted for the patching to work. This way we test a slightly more real-life case on CI (Path.home() is not patched, but that's fine, because the CI does not have a user set up.) we locally keep ~./brainglobe/ (user data) and ~/.brainglobe-tests/.brainglobe/ (tests interacting with fake user data) always completely separate.