def test_load_yaml_file(tmpdir): tmp_file = tmpdir.join('test_file.yaml') tmp_file.write(TEST_YAML_ONE) d = ConfigTree() d.load(str(tmp_file)) assert d.test_section.test_key == 'test_value' assert d.test_section.test_key2 == 'test_value2' assert d.test_section2.test_key == 'test_value3'
import os import yaml import numpy numpy.seterr(all='raise') from vivarium.config_tree import ConfigTree __all__ = ['config', 'VivariumError'] class VivariumError(Exception): pass config = ConfigTree( layers=['base', 'component_configs', 'model_override', 'override']) if os.path.exists(os.path.expanduser('~/vivarium.yaml')): config.load(os.path.expanduser('~/vivarium.yaml'), layer='override', source=os.path.expanduser('~/vivarium.yaml'))