From dfb7878b674e8eed1cfa55928d5464dc6fb0f085 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 16 Jul 2009 05:50:31 -0400 Subject: Renamed test->manipulate_encodings in becommands.*.execute. Reminder from my initial libbe/encoding.py commit: Because of the stdout replacement, the doctests executes now need an optional 'test' argument to turn off replacement during the doctests, otherwise doctest flips out (since it had set up stdout to catch output, and then we clobbered it's setup). I'm also trying to catch stdout/stderr from be-handle-mail, and I ran into the same problem. It took me a bit to remember exactly what "test" was supposed to do, so I thought I'd make the argument name more specific. If you need other changes when running in "test" mode, you'll have to add other kwargs. --- becommands/close.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'becommands/close.py') diff --git a/becommands/close.py b/becommands/close.py index 0ba8f50..05bdc10 100644 --- a/becommands/close.py +++ b/becommands/close.py @@ -20,7 +20,7 @@ from libbe import cmdutil, bugdir __desc__ = __doc__ -def execute(args, test=False): +def execute(args, manipulate_encodings=True): """ >>> from libbe import bugdir >>> import os @@ -28,7 +28,7 @@ def execute(args, test=False): >>> os.chdir(bd.root) >>> print bd.bug_from_shortname("a").status open - >>> execute(["a"], test=True) + >>> execute(["a"], manipulate_encodings=False) >>> bd._clear_bugs() >>> print bd.bug_from_shortname("a").status closed @@ -41,7 +41,8 @@ def execute(args, test=False): raise cmdutil.UsageError("Please specify a bug id.") if len(args) > 1: raise cmdutil.UsageError("Too many arguments.") - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) bug = bd.bug_from_shortname(args[0]) bug.status = "closed" bd.save() -- cgit From 4e8882e74aad64859a16f17fa6bef8c04b33913d Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 29 Jul 2009 15:46:37 -0400 Subject: Added clean messages on bug_from_shortname failure. So user's don't get confused. --- becommands/close.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'becommands/close.py') diff --git a/becommands/close.py b/becommands/close.py index 0ba8f50..327817a 100644 --- a/becommands/close.py +++ b/becommands/close.py @@ -42,7 +42,7 @@ def execute(args, test=False): if len(args) > 1: raise cmdutil.UsageError("Too many arguments.") bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) - bug = bd.bug_from_shortname(args[0]) + bug = cmdutil.bug_from_shortname(bd, args[0]) bug.status = "closed" bd.save() -- cgit From 58cba607535cd33c97fd5dc3737c9da4afa9a6bb Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 31 Jul 2009 14:59:06 -0400 Subject: Improved unittest cleanup by adding BugDir.cleanup(). Also simple_bug_dir -> SimpleBugDir class, which allows me to add utility.Dir cleanup to SimpleBugDir.cleanup(). Still having a bit of trouble with the becommand.new tests due to bugdir loading though... --- becommands/close.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'becommands/close.py') diff --git a/becommands/close.py b/becommands/close.py index 12848b2..0532ed2 100644 --- a/becommands/close.py +++ b/becommands/close.py @@ -24,7 +24,7 @@ def execute(args, manipulate_encodings=True): """ >>> from libbe import bugdir >>> import os - >>> bd = bugdir.simple_bug_dir() + >>> bd = bugdir.SimpleBugDir() >>> os.chdir(bd.root) >>> print bd.bug_from_shortname("a").status open @@ -32,6 +32,7 @@ def execute(args, manipulate_encodings=True): >>> bd._clear_bugs() >>> print bd.bug_from_shortname("a").status closed + >>> bd.cleanup() """ parser = get_parser() options, args = parser.parse_args(args) -- cgit