summaryrefslogtreecommitdiff
path: root/test/git/async/test_graph.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-10 00:24:49 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-10 00:24:49 +0200
commit3323464f85b986cba23176271da92a478b33ab9c (patch)
tree1633f83f6c5fd5a98396fc925b44602282cbd15a /test/git/async/test_graph.py
parent257a8a9441fca9a9bc384f673ba86ef5c3f1715d (diff)
downloadgitpython-3323464f85b986cba23176271da92a478b33ab9c.tar.gz
messy first version of a properly working depth-first graph method, which allows the pool to work as expected. Many more tests need to be added, and there still is a problem with shutdown as sometimes it won't kill all threads, mainly because the process came up with worker threads started, which cannot be
Diffstat (limited to 'test/git/async/test_graph.py')
-rw-r--r--test/git/async/test_graph.py29
1 files changed, 4 insertions, 25 deletions
diff --git a/test/git/async/test_graph.py b/test/git/async/test_graph.py
index 1a153e2d..d0e36159 100644
--- a/test/git/async/test_graph.py
+++ b/test/git/async/test_graph.py
@@ -61,31 +61,10 @@ class TestGraph(TestBase):
assert len(n1.out_nodes) == 0
# check the history from the last node
- last = g.nodes[-1]
- class Visitor(object):
- def __init__(self, origin):
- self.origin_seen = False
- self.origin = origin
- self.num_seen = 0
-
- def __call__(self, n):
- if n is self.origin:
- self.origin_seen = True
- else:
- assert not self.origin_seen, "should see origin last"
- # END check origin
- self.num_seen += 1
- return True
-
- def _assert(self, num_expected):
- assert self.origin_seen
- assert self.num_seen == num_expected
- # END visitor helper
-
end = g.nodes[-1]
- visitor = Visitor(end)
- g.visit_input_inclusive_depth_first(end, visitor)
-
+ dfirst_nodes = g.input_inclusive_dfirst_reversed(end)
num_nodes_seen = nn - 2 # deleted second, which leaves first one disconnected
- visitor._assert(num_nodes_seen)
+ assert len(dfirst_nodes) == num_nodes_seen
+ assert dfirst_nodes[-1] == end and dfirst_nodes[-2].id == end.id-1
+