[Python-checkins] distutils2: merged.
tarek.ziade
python-checkins at python.org
Sun Jan 23 15:48:23 CET 2011
tarek.ziade pushed 853e7bc6237c to distutils2:
http://hg.python.org/distutils2/rev/853e7bc6237c
changeset: 882:853e7bc6237c
parent: 881:24b3ffc522d9
parent: 869:56623741c144
user: Louis Munro <lm at louismunro.com>
date: Wed Dec 08 23:03:27 2010 -0500
summary:
merged.
files:
diff --git a/distutils2/tests/test_depgraph.py b/distutils2/tests/test_depgraph.py
--- a/distutils2/tests/test_depgraph.py
+++ b/distutils2/tests/test_depgraph.py
@@ -184,6 +184,67 @@
self.checkLists(matches, expected)
+ def test_graph_disconnected_to_dot(self):
+ dependencies_expected = (
+ ('towel-stuff', 'bacon', 'bacon (<=0.2)'),
+ ('grammar', 'bacon', 'truffles (>=1.2)'),
+ ('choxie', 'towel-stuff', 'towel-stuff (0.1)'),
+ ('banana', 'strawberry', 'strawberry (>=0.5)')
+ )
+ disconnected_expected = ('cheese', 'bacon', 'strawberry')
+
+ dists = []
+ for name in self.DISTROS_DIST + self.DISTROS_EGG:
+ dist = pkgutil.get_distribution(name, use_egg_info=True)
+ self.assertNotEqual(dist, None)
+ dists.append(dist)
+
+ graph = depgraph.generate_graph(dists)
+ buf = StringIO.StringIO()
+ depgraph.graph_to_dot(graph, buf, skip_disconnected=False)
+ buf.seek(0)
+ lines = buf.readlines()
+
+ dependencies_lines = []
+ disconnected_lines = []
+
+ # First sort output lines into dependencies and disconnected lines.
+ # We also skip the attribute lines, and don't include the "{" and "}"
+ # lines.
+ disconnected_active = False
+ for line in lines[1:-1]: # Skip first and last line
+ if line.startswith('subgraph disconnected'):
+ disconnected_active = True
+ continue
+ if line.startswith('}') and disconnected_active:
+ disconnected_active = False
+ continue
+
+ if disconnected_active:
+ # Skip the 'label = "Disconnected"', etc. attribute lines.
+ if ' = ' not in line:
+ disconnected_lines.append(line)
+ else:
+ dependencies_lines.append(line)
+
+ dependencies_matches = []
+ for line in dependencies_lines:
+ if line[-1] == '\n':
+ line = line[:-1]
+ match = self.EDGE.match(line.strip())
+ self.assertTrue(match is not None)
+ dependencies_matches.append(match.groups())
+
+ disconnected_matches = []
+ for line in disconnected_lines:
+ if line[-1] == '\n':
+ line = line[:-1]
+ line = line.strip('"')
+ disconnected_matches.append(line)
+
+ self.checkLists(dependencies_matches, dependencies_expected)
+ self.checkLists(disconnected_matches, disconnected_expected)
+
def test_graph_bad_version_to_dot(self):
expected = (
('towel-stuff', 'bacon', 'bacon (<=0.2)'),
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list