Skip to content
Snippets Groups Projects
Commit 02b267cd authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Merge branch 'subconfig' into 'master'

Subconfig

See merge request !65
parents bd98b574 04b61f06
Branches
Tags
1 merge request!65Fix loading config files from different packages
Pipeline #
......@@ -178,8 +178,10 @@ def load(paths, context=None, entry_point_group=None):
for k,n in zip(paths, names):
logger.debug("Loading configuration file `%s'...", k)
mod = imp.new_module(n)
# remove the keys that might break the loading of the next config file.
ctxt.__dict__.pop('__name__', None)
ctxt.__dict__.pop('__package__', None)
mod.__dict__.update(ctxt.__dict__)
mod.__name__ = n #reverse module-name override
LOADED_CONFIGS.append(mod)
ctxt = _load_context(k, mod)
......
from ..basic_config import *
......@@ -49,6 +49,7 @@ def test_entry_point_configs():
os.path.join(path, 'basic_config.py'),
'resource_config',
'bob.extension.data.basic_config',
'subpackage_config',
], entry_point_group='bob.extension.test_config_load')
assert hasattr(c, "a") and c.a == 1
assert hasattr(c, "b") and c.b == 3
......
......@@ -45,6 +45,7 @@ setup(
'bob.extension.test_config_load': [
'basic_config = bob.extension.data.basic_config',
'resource_config = bob.extension.data.resource_config',
'subpackage_config = bob.extension.data.subpackage.config',
],
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment