aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-31 14:59:06 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-31 14:59:06 -0400
commit58cba607535cd33c97fd5dc3737c9da4afa9a6bb (patch)
tree7f5cfec092fe27735bf1228fb124601a920fc85f /becommands
parent3c4ce1b4519186007f2568569b1bff55cdbb108f (diff)
downloadbugseverywhere-58cba607535cd33c97fd5dc3737c9da4afa9a6bb.tar.gz
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...
Diffstat (limited to 'becommands')
-rw-r--r--becommands/assign.py3
-rw-r--r--becommands/close.py3
-rw-r--r--becommands/comment.py3
-rw-r--r--becommands/commit.py3
-rw-r--r--becommands/depend.py3
-rw-r--r--becommands/diff.py3
-rw-r--r--becommands/list.py3
-rw-r--r--becommands/merge.py3
-rw-r--r--becommands/new.py5
-rw-r--r--becommands/open.py3
-rw-r--r--becommands/remove.py3
-rw-r--r--becommands/set.py3
-rw-r--r--becommands/severity.py3
-rw-r--r--becommands/show.py3
-rw-r--r--becommands/status.py3
-rw-r--r--becommands/subscribe.py6
-rw-r--r--becommands/tag.py3
-rw-r--r--becommands/target.py3
18 files changed, 39 insertions, 20 deletions
diff --git a/becommands/assign.py b/becommands/assign.py
index 7b32bdd..794f028 100644
--- a/becommands/assign.py
+++ b/becommands/assign.py
@@ -23,7 +23,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> bd.bug_from_shortname("a").assigned is None
True
@@ -42,6 +42,7 @@ def execute(args, manipulate_encodings=True):
>>> bd._clear_bugs()
>>> bd.bug_from_shortname("a").assigned is None
True
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
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)
diff --git a/becommands/comment.py b/becommands/comment.py
index 14872a3..69e3a41 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -28,7 +28,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import time
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> execute(["a", "This is a comment about a"], manipulate_encodings=False)
>>> bd._clear_bugs()
@@ -60,6 +60,7 @@ def execute(args, manipulate_encodings=True):
>>> print comment.body
I like cheese
<BLANKLINE>
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/commit.py b/becommands/commit.py
index 4f3bdbd..fb85651 100644
--- a/becommands/commit.py
+++ b/becommands/commit.py
@@ -22,13 +22,14 @@ 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)
>>> full_path = "testfile"
>>> test_contents = "A test file"
>>> bd.rcs.set_file_contents(full_path, test_contents)
>>> execute(["Added %s." % (full_path)], manipulate_encodings=False) # doctest: +ELLIPSIS
Committed ...
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/depend.py b/becommands/depend.py
index fd38bd1..3d63e2f 100644
--- a/becommands/depend.py
+++ b/becommands/depend.py
@@ -21,7 +21,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> from libbe import utility
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> bd.save()
>>> os.chdir(bd.root)
>>> execute(["a", "b"], manipulate_encodings=False)
@@ -34,6 +34,7 @@ def execute(args, manipulate_encodings=True):
Blocks on a:
b closed
>>> execute(["-r", "a", "b"], manipulate_encodings=False)
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/diff.py b/becommands/diff.py
index 1ab2135..034823d 100644
--- a/becommands/diff.py
+++ b/becommands/diff.py
@@ -23,7 +23,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> bd.set_sync_with_disk(True)
>>> original = bd.rcs.commit("Original status")
>>> bug = bd.bug_from_uuid("a")
@@ -48,6 +48,7 @@ def execute(args, manipulate_encodings=True):
... else:
... print "This directory is not revision-controlled."
This directory is not revision-controlled.
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/list.py b/becommands/list.py
index 50038e6..12e1e29 100644
--- a/becommands/list.py
+++ b/becommands/list.py
@@ -29,13 +29,14 @@ AVAILABLE_CMPS.remove("attr") # a cmp_* template.
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> execute([], manipulate_encodings=False)
a:om: Bug A
>>> execute(["--status", "all"], manipulate_encodings=False)
a:om: Bug A
b:cm: Bug B
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/merge.py b/becommands/merge.py
index 6651869..f212b01 100644
--- a/becommands/merge.py
+++ b/becommands/merge.py
@@ -21,7 +21,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> from libbe import utility
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> bd.set_sync_with_disk(True)
>>> a = bd.bug_from_shortname("a")
>>> a.comment_root.time = 0
@@ -120,6 +120,7 @@ def execute(args, manipulate_encodings=True):
Merged into bug a
>>> print b.status
closed
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
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)
diff --git a/becommands/open.py b/becommands/open.py
index bfb54ea..0c6bf05 100644
--- a/becommands/open.py
+++ b/becommands/open.py
@@ -23,7 +23,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> print bd.bug_from_shortname("b").status
closed
@@ -31,6 +31,7 @@ def execute(args, manipulate_encodings=True):
>>> bd._clear_bugs()
>>> print bd.bug_from_shortname("b").status
open
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/remove.py b/becommands/remove.py
index bc7b5ed..8d85033 100644
--- a/becommands/remove.py
+++ b/becommands/remove.py
@@ -21,7 +21,7 @@ def execute(args, manipulate_encodings=True):
"""
>>> from libbe import mapfile
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> print bd.bug_from_shortname("b").status
closed
@@ -33,6 +33,7 @@ def execute(args, manipulate_encodings=True):
... except bugdir.NoBugMatches:
... print "Bug not found"
Bug not found
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
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)
diff --git a/becommands/severity.py b/becommands/severity.py
index a14a96b..660586e 100644
--- a/becommands/severity.py
+++ b/becommands/severity.py
@@ -23,7 +23,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> execute(["a"], manipulate_encodings=False)
minor
@@ -33,6 +33,7 @@ def execute(args, manipulate_encodings=True):
>>> execute(["a", "none"], manipulate_encodings=False)
Traceback (most recent call last):
UserError: Invalid severity level: none
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/show.py b/becommands/show.py
index bb16fe5..50bd6eb 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -25,7 +25,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> execute (["a",], manipulate_encodings=False) # doctest: +ELLIPSIS
ID : a
@@ -50,6 +50,7 @@ def execute(args, manipulate_encodings=True):
<created>...</created>
<summary>Bug A</summary>
</bug>
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/status.py b/becommands/status.py
index e4db787..f315003 100644
--- a/becommands/status.py
+++ b/becommands/status.py
@@ -20,7 +20,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> execute(["a"], manipulate_encodings=False)
open
@@ -30,6 +30,7 @@ def execute(args, manipulate_encodings=True):
>>> execute(["a", "none"], manipulate_encodings=False)
Traceback (most recent call last):
UserError: Invalid status: none
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/subscribe.py b/becommands/subscribe.py
index 64a2867..b754937 100644
--- a/becommands/subscribe.py
+++ b/becommands/subscribe.py
@@ -57,7 +57,7 @@ class InvalidType (ValueError):
def execute(args, manipulate_encodings=True):
"""
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> bd.set_sync_with_disk(True)
>>> os.chdir(bd.root)
>>> a = bd.bug_from_shortname("a")
@@ -96,6 +96,7 @@ def execute(args, manipulate_encodings=True):
>>> execute(["-s","Jane Doe <J@doe.com>", "DIR"], manipulate_encodings=False) # doctest: +NORMALIZE_WHITESPACE
Subscriptions for bug directory:
Jane Doe <J@doe.com> all *
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
@@ -337,7 +338,7 @@ def get_bugdir_subscribers(bugdir, server):
where id is either a bug.uuid (in the case of a bug subscription)
or "DIR" (in the case of a bugdir subscription).
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir(sync_with_disk=False)
>>> a = bd.bug_from_shortname("a")
>>> bd.extra_strings = subscribe(bd.extra_strings, "John Doe <j@doe.com>", [BUGDIR_TYPE_ALL], ["a.com"], BUGDIR_TYPE_ALL)
>>> bd.extra_strings = subscribe(bd.extra_strings, "Jane Doe <J@doe.com>", [BUGDIR_TYPE_NEW], ["*"], BUGDIR_TYPE_ALL)
@@ -351,6 +352,7 @@ def get_bugdir_subscribers(bugdir, server):
[<SubscriptionType: all>]
>>> get_bugdir_subscribers(bd, "b.net")
{'Jane Doe <J@doe.com>': {'DIR': [<SubscriptionType: new>]}}
+ >>> bd.cleanup()
"""
subscribers = {}
for sub in get_subscribers(bugdir.extra_strings, BUGDIR_TYPE_ALL, server,
diff --git a/becommands/tag.py b/becommands/tag.py
index e749a31..ecd853f 100644
--- a/becommands/tag.py
+++ b/becommands/tag.py
@@ -21,7 +21,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> from libbe import utility
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> bd.set_sync_with_disk(True)
>>> os.chdir(bd.root)
>>> a = bd.bug_from_shortname("a")
@@ -66,6 +66,7 @@ def execute(args, manipulate_encodings=True):
Tags for a:
Alphabetically first
>>> execute(["--remove", "a", "Alphabetically first"], manipulate_encodings=False)
+ >>> bd.cleanup()
"""
parser = get_parser()
options, args = parser.parse_args(args)
diff --git a/becommands/target.py b/becommands/target.py
index 5d0453a..7e41451 100644
--- a/becommands/target.py
+++ b/becommands/target.py
@@ -25,7 +25,7 @@ __desc__ = __doc__
def execute(args, manipulate_encodings=True):
"""
>>> import os
- >>> bd = bugdir.simple_bug_dir()
+ >>> bd = bugdir.SimpleBugDir()
>>> os.chdir(bd.root)
>>> execute(["a"], manipulate_encodings=False)
No target assigned.
@@ -37,6 +37,7 @@ def execute(args, manipulate_encodings=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)