Minor packaging cleanup.
- Use shortcut dist.version instead of going through metadata;
- Use %r throughout to display project names and paths.
diff --git a/Lib/packaging/tests/test_database.py b/Lib/packaging/tests/test_database.py
index 3eeda83..119fa23 100644
--- a/Lib/packaging/tests/test_database.py
+++ b/Lib/packaging/tests/test_database.py
@@ -302,7 +302,7 @@
self.assertIsInstance(dist, Distribution)
if (dist.name in dict(fake_dists) and
dist.path.startswith(self.fake_dists_path)):
- found_dists.append((dist.name, dist.metadata['version'], ))
+ found_dists.append((dist.name, dist.version))
else:
# check that it doesn't find anything more than this
self.assertFalse(dist.path.startswith(self.fake_dists_path))
@@ -323,7 +323,7 @@
self.assertIsInstance(dist, (Distribution, EggInfoDistribution))
if (dist.name in dict(fake_dists) and
dist.path.startswith(self.fake_dists_path)):
- found_dists.append((dist.name, dist.metadata['version']))
+ found_dists.append((dist.name, dist.version))
else:
self.assertFalse(dist.path.startswith(self.fake_dists_path))
@@ -489,17 +489,17 @@
checkLists([], _yield_distributions(False, False, sys.path))
- found = [(dist.name, dist.metadata['Version'])
+ found = [(dist.name, dist.version)
for dist in _yield_distributions(False, True, sys.path)
if dist.path.startswith(self.fake_dists_path)]
checkLists(eggs, found)
- found = [(dist.name, dist.metadata['Version'])
+ found = [(dist.name, dist.version)
for dist in _yield_distributions(True, False, sys.path)
if dist.path.startswith(self.fake_dists_path)]
checkLists(dists, found)
- found = [(dist.name, dist.metadata['Version'])
+ found = [(dist.name, dist.version)
for dist in _yield_distributions(True, True, sys.path)
if dist.path.startswith(self.fake_dists_path)]
checkLists(dists + eggs, found)
diff --git a/Lib/packaging/tests/test_install.py b/Lib/packaging/tests/test_install.py
index 35733c8..cf0817c 100644
--- a/Lib/packaging/tests/test_install.py
+++ b/Lib/packaging/tests/test_install.py
@@ -29,7 +29,7 @@
self.metadata['Requires-Dist'] = deps
def __repr__(self):
- return '<InstalledDist %s>' % self.metadata['Name']
+ return '<InstalledDist %r>' % self.metadata['Name']
class ToInstallDist: