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/set.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'becommands/set.py') diff --git a/becommands/set.py b/becommands/set.py index 510eca7..7bef644 100644 --- a/becommands/set.py +++ b/becommands/set.py @@ -32,18 +32,18 @@ def _value_string(bd, setting): val = None return str(val) -def execute(args, test=False): +def execute(args, manipulate_encodings=True): """ >>> import os >>> bd = bugdir.simple_bug_dir() >>> os.chdir(bd.root) - >>> execute(["target"], test=True) + >>> execute(["target"], manipulate_encodings=False) None - >>> execute(["target", "tomorrow"], test=True) - >>> execute(["target"], test=True) + >>> execute(["target", "tomorrow"], manipulate_encodings=False) + >>> execute(["target"], manipulate_encodings=False) tomorrow - >>> execute(["target", "none"], test=True) - >>> execute(["target"], test=True) + >>> execute(["target", "none"], manipulate_encodings=False) + >>> execute(["target"], manipulate_encodings=False) None """ parser = get_parser() @@ -51,7 +51,8 @@ def execute(args, test=False): complete(options, args, parser) if len(args) > 2: 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) if len(args) == 0: keys = bd.settings_properties keys.sort() -- 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/set.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'becommands/set.py') diff --git a/becommands/set.py b/becommands/set.py index f7fca54..e78a1ea 100644 --- a/becommands/set.py +++ b/becommands/set.py @@ -35,7 +35,7 @@ def _value_string(bd, setting): def execute(args, manipulate_encodings=True): """ >>> import os - >>> bd = bugdir.simple_bug_dir() + >>> bd = bugdir.SimpleBugDir() >>> os.chdir(bd.root) >>> execute(["target"], manipulate_encodings=False) None @@ -45,6 +45,7 @@ def execute(args, manipulate_encodings=True): >>> execute(["target", "none"], manipulate_encodings=False) >>> execute(["target"], manipulate_encodings=False) None + >>> bd.cleanup() """ parser = get_parser() options, args = parser.parse_args(args) -- cgit From 6d3fc831cdbba47a90b03706f25af1682abe862b Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 31 Aug 2009 13:43:32 -0400 Subject: RCS -> VCS, BUGDIR_DISK_VERSION -> v1.2 --- becommands/set.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'becommands/set.py') diff --git a/becommands/set.py b/becommands/set.py index e78a1ea..f7e68d3 100644 --- a/becommands/set.py +++ b/becommands/set.py @@ -19,7 +19,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """Change tree settings""" import textwrap -from libbe import cmdutil, bugdir, rcs, settings_object +from libbe import cmdutil, bugdir, vcs, settings_object __desc__ = __doc__ def _value_string(bd, setting): @@ -87,12 +87,12 @@ def get_bugdir_settings(): set = getattr(bugdir.BugDir, s) dstr = set.__doc__.strip() # per-setting comment adjustments - if s == "rcs_name": + if s == "vcs_name": lines = dstr.split('\n') while lines[0].startswith("This property defaults to") == False: lines.pop(0) assert len(lines) != None, \ - "Unexpected rcs_name docstring:\n '%s'" % dstr + "Unexpected vcs_name docstring:\n '%s'" % dstr lines.insert( 0, "The name of the revision control system to use.\n") dstr = '\n'.join(lines) -- cgit