Hi,<br> <br>I was trying to write a blackbox test for a command in a plugin which<br>requires custom rules for the test, <br>and figured out that its not so easy to do that at the moment.<br>this patch does the following:<br>
* extract rules.reset_rules() which instantiates our default user-based rule object<br> which can be called from tests to reload it.<br> * tree.iter_search_rules now uses the default parameter differently<br> to ensure that if we change our rules._per_user_searcher<br>
after tree.py loaded, that the new one will get used.<br><br clear="all">with it, its possible to write rule-dependant blackbox tests similar to some of the blackbox<br>tests relying on configs. eg.<br><br>def test_something(self):<br>
config.ensure_config_dir_exists()<br> open(rules.rules_filename(),'wb').write("""<br>[name *.py]<br>foo=bar<br>""")<br> rules.reset_rules()<br> # run test that depends on the rule<br>
out,err = self.run_bzr('my-command')<br><br><br>-- <br><| regards<br>U| Marius<br>H| <>< <br>