Loading too much during imports
dougransom opened this issue · 1 comments
There are places where config files are ready during import. this is from natlinkstatus.py
_config_locations = loader.config_locations() Logger.debug(f"{__file__} Configugure {_config_locations}") Config = config.NatlinkConfig.from_first_found_file(_config_locations) Logger.debug(f"{__file__} Config {Config}") natlinkmain = loader.NatlinkMain(Logger, Config)
It makes it somewhat difficult to write code (especially tests) which might specify a config file and use the code. They don't have a chance to specify the config file because they need to import natlinkcore files for the python to compile.
I would think we should try and find a way to load the config files later, after the import.
I made the changes here dougransom@d9ef89c.
@quintijn can you take a quick look make sure they seem ok please?