[MERGE] Make it possible to blackboxtest rules
Marius Kruger
amanic at gmail.com
Sat May 2 22:39:51 BST 2009
Hi,
I was trying to write a blackbox test for a command in a plugin which
requires custom rules for the test,
and figured out that its not so easy to do that at the moment.
this patch does the following:
* extract rules.reset_rules() which instantiates our default user-based
rule object
which can be called from tests to reload it.
* tree.iter_search_rules now uses the default parameter differently
to ensure that if we change our rules._per_user_searcher
after tree.py loaded, that the new one will get used.
with it, its possible to write rule-dependant blackbox tests similar to some
of the blackbox
tests relying on configs. eg.
def test_something(self):
config.ensure_config_dir_exists()
open(rules.rules_filename(),'wb').write("""
[name *.py]
foo=bar
""")
rules.reset_rules()
# run test that depends on the rule
out,err = self.run_bzr('my-command')
--
<| regards
U| Marius
H| <><
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20090502/f683a354/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20090502_2326-bzr.rules.patch
Type: text/x-diff
Size: 3683 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090502/f683a354/attachment.bin
More information about the bazaar
mailing list