Example #1
0
def _on_config_changed(changed_name: str) -> None:
    """Call config_changed hooks if the config changed."""
    for mod_info in _module_infos:
        if mod_info.skip_hooks:
            continue
        for option, hook in mod_info.config_changed_hooks:
            if option is None:
                hook()
            else:
                cfilter = config.change_filter(option)
                cfilter.validate()
                if cfilter.check_match(changed_name):
                    hook()
Example #2
0
def _on_config_changed(changed_name: str) -> None:
    """Call config_changed hooks if the config changed."""
    for mod_info in _module_infos:
        if mod_info.skip_hooks:
            continue
        for option, hook in mod_info.config_changed_hooks:
            if option is None:
                hook()
            else:
                cfilter = config.change_filter(option)
                cfilter.validate()
                if cfilter.check_match(changed_name):
                    hook()
Example #3
0
 def test_validate(self, option):
     cf = config.change_filter(option)
     cf.validate()
     assert cf in config.change_filters
Example #4
0
 def test_unknown_option(self, option):
     cf = config.change_filter(option)
     with pytest.raises(configexc.NoOptionError):
         cf.validate()
Example #5
0
 def test_validate(self, option):
     cf = config.change_filter(option)
     cf.validate()
     assert cf in config.change_filters
Example #6
0
 def test_unknown_option(self, option):
     cf = config.change_filter(option)
     with pytest.raises(configexc.NoOptionError):
         cf.validate()
Example #7
0
 def test_invalid_change_filter(self, init_patch, args):
     config.change_filter('foobar')
     with pytest.raises(configexc.NoOptionError):
         configinit.early_init(args)
 def test_invalid_change_filter(self, init_patch, args):
     config.change_filter('foobar')
     with pytest.raises(configexc.NoOptionError):
         configinit.early_init(args)
Example #9
0
def test_early_init_invalid_change_filter(init_patch, fake_args):
    config.change_filter('foobar')
    with pytest.raises(configexc.NoOptionError):
        config.early_init(fake_args)