def test_defaults(self): with TempFiles() as tmp: with open(tmp[0], 'wb') as f: f.write(TestDefaultsLoading.defaults_yaml) load_base_config(config_file=tmp[0], clear_existing=True) assert base_config().biz == 'foobar' assert base_config().wiz == 'foobar' assert base_config().foo.bar.ham == 2 assert base_config().foo.bar.eggs == 4 assert not hasattr(base_config(), 'wms')
def test_user_srs_definitions(self): user_yaml = b""" srs: axis_order_ne: ['EPSG:9999'] """ with TempFiles() as tmp: with open(tmp[0], 'wb') as f: f.write(user_yaml) load_base_config(config_file=tmp[0]) assert 'EPSG:9999' in base_config().srs.axis_order_ne assert 'EPSG:9999' not in base_config().srs.axis_order_en #defaults still there assert 'EPSG:31468' in base_config().srs.axis_order_ne assert 'CRS:84' in base_config().srs.axis_order_en
def test_defaults_overwrite(self): with TempFiles(2) as tmp: with open(tmp[0], 'wb') as f: f.write(TestDefaultsLoading.defaults_yaml) with open(tmp[1], 'wb') as f: f.write(b""" baz: [9, 2, 1, 4] biz: 'barfoo' foo: bar: eggs: 5 """) load_base_config(config_file=tmp[0], clear_existing=True) load_base_config(config_file=tmp[1]) assert base_config().biz == 'barfoo' assert base_config().wiz == 'foobar' assert base_config().baz == [9, 2, 1, 4] assert base_config().foo.bar.ham == 2 assert base_config().foo.bar.eggs == 5 assert not hasattr(base_config(), 'wms')
def teardown_module(): load_base_config(clear_existing=True)