aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/target.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/target.py')
-rw-r--r--becommands/target.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/becommands/target.py b/becommands/target.py
index 527b16a..7e41451 100644
--- a/becommands/target.py
+++ b/becommands/target.py
@@ -22,21 +22,22 @@
from libbe import cmdutil, bugdir
__desc__ = __doc__
-def execute(args, test=False):
+def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
- >>> execute(["a"], test=True)
+ >>> execute(["a"], manipulate_encodings=False)
No target assigned.
- >>> execute(["a", "tomorrow"], test=True)
- >>> execute(["a"], test=True)
+ >>> execute(["a", "tomorrow"], manipulate_encodings=False)
+ >>> execute(["a"], manipulate_encodings=False)
tomorrow
- >>> execute(["--list"], test=True)
+ >>> execute(["--list"], manipulate_encodings=False)
tomorrow
- >>> execute(["a", "none"], test=True)
- >>> execute(["a"], test=True)
+ >>> execute(["a", "none"], manipulate_encodings=False)
+ >>> execute(["a"], manipulate_encodings=False)
No target assigned.
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
@@ -46,14 +47,15 @@ def execute(args, test=False):
if len(args) not in (1, 2):
if not (options.list == True and len(args) == 0):
raise cmdutil.UsageError
- bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+ bd = bugdir.BugDir(from_disk=True,
+ manipulate_encodings=manipulate_encodings)
if options.list:
ts = set([bd.bug_from_uuid(bug).target for bug in bd.list_uuids()])
for target in sorted(ts):
if target and isinstance(target,str):
print target
return
- bug = bd.bug_from_shortname(args[0])
+ bug = cmdutil.bug_from_shortname(bd, args[0])
if len(args) == 1:
if bug.target is None:
print "No target assigned."