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/new.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'becommands/new.py') diff --git a/becommands/new.py b/becommands/new.py index f94335b..9f0045d 100644 --- a/becommands/new.py +++ b/becommands/new.py @@ -18,14 +18,14 @@ from libbe import cmdutil, bugdir __desc__ = __doc__ -def execute(args, test=False): +def execute(args, manipulate_encodings=True): """ >>> import os, time >>> from libbe import bug >>> bd = bugdir.simple_bug_dir() >>> os.chdir(bd.root) >>> bug.uuid_gen = lambda: "X" - >>> execute (["this is a test",], test=True) + >>> execute (["this is a test",], manipulate_encodings=False) Created bug with ID X >>> bd.load() >>> bug = bd.bug_from_uuid("X") @@ -43,7 +43,8 @@ def execute(args, test=False): cmdutil.default_complete(options, args, parser) if len(args) != 1: raise cmdutil.UsageError("Please supply a summary message") - bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + bd = bugdir.BugDir(from_disk=True, + manipulate_encodings=manipulate_encodings) if args[0] == '-': # read summary from stdin summary = sys.stdin.readline() else: -- 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/new.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'becommands/new.py') diff --git a/becommands/new.py b/becommands/new.py index 2487bac..1900c7a 100644 --- a/becommands/new.py +++ b/becommands/new.py @@ -23,12 +23,12 @@ def execute(args, manipulate_encodings=True): """ >>> import os, time >>> from libbe import bug - >>> bd = bugdir.simple_bug_dir() + >>> bd = bugdir.SimpleBugDir() >>> os.chdir(bd.root) >>> bug.uuid_gen = lambda: "X" >>> execute (["this is a test",], manipulate_encodings=False) Created bug with ID X - >>> bd.load() + >>> bd.load() # breaks simple bug dir rcs for cleanup! >>> bug = bd.bug_from_uuid("X") >>> print bug.summary this is a test @@ -38,6 +38,7 @@ def execute(args, manipulate_encodings=True): minor >>> bug.target == None True + >>> bd.cleanup() """ parser = get_parser() options, args = parser.parse_args(args) -- cgit From f24d7264396cb1be8b46b17f9335abf7bcd09ef2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 31 Jul 2009 15:05:19 -0400 Subject: Now becommands.new's unittest cleans up after itself. --- becommands/new.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'becommands/new.py') diff --git a/becommands/new.py b/becommands/new.py index 1900c7a..a8ee2ec 100644 --- a/becommands/new.py +++ b/becommands/new.py @@ -28,7 +28,7 @@ def execute(args, manipulate_encodings=True): >>> bug.uuid_gen = lambda: "X" >>> execute (["this is a test",], manipulate_encodings=False) Created bug with ID X - >>> bd.load() # breaks simple bug dir rcs for cleanup! + >>> bd._clear_bugs() >>> bug = bd.bug_from_uuid("X") >>> print bug.summary this is a test -- cgit