silx-kit / silx

silx toolkit
http://www.silx.org/doc/silx/latest/
MIT License
129 stars 73 forks source link

[ExternalResources] Allow to set `_data_home` #4127

Closed loichuder closed 2 months ago

loichuder commented 4 months ago

When using ExternalResources in a pytest test, I want the downloaded data to be put in the tmpdir provided by the pytest fixture.

But so far, there is no way of setting data_home, be it in the constructor of ExternalResources or via a setter, forcing me to do:

silx_resources = ExternalResources(
      PROJECT_NAME, url_base="http://www.silx.org/pub"
  )
silx_resources._data_home = tmpdir

I think adding a way of setting data_home via the constructor is quite sensible. I can do a PR if you agree.