quilt icon indicating copy to clipboard operation
quilt copied to clipboard

Config resolution at import

Open birnbera opened this issue 2 years ago • 0 comments

I'm using the Quilt API in my own code and have found testing package logic to be a challenge without polluting my default local registry. The problem comes from the fact that the default config locations are set as global variables in util.py even though they do respect platform specific envars, such as XDG_*. Thus, during testing, you can't override the registry location and/or config files for individual tests without mocking in several different places or restarting the interpreter.

One way to improve the API would be to create a Config type that could be passed to dependent types, e.g., Package. These in turn could by default use a predefined global Config object that uses the paths as currently defined, but could be overridden when necessary.

birnbera avatar Oct 04 '23 23:10 birnbera