summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/tests/test_database.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-05-19 18:25:10 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2011-05-19 18:25:10 (GMT)
commitcad648cbc95db0a5d694bd73a6a4ba2505920066 (patch)
treeb1894b64804ca923eb52c92a65517130e87e1aa0 /Lib/packaging/tests/test_database.py
parentebbb14c1a1ec226b06f96d1fc581122558e1385e (diff)
downloadcpython-cad648cbc95db0a5d694bd73a6a4ba2505920066.zip
cpython-cad648cbc95db0a5d694bd73a6a4ba2505920066.tar.gz
cpython-cad648cbc95db0a5d694bd73a6a4ba2505920066.tar.bz2
Skip tests that require zlib in the packaging tests. Also add a requires_zlib decorator to test.support.
Diffstat (limited to 'Lib/packaging/tests/test_database.py')
-rw-r--r--Lib/packaging/tests/test_database.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/packaging/tests/test_database.py b/Lib/packaging/tests/test_database.py
index 251181a..c8d6385 100644
--- a/Lib/packaging/tests/test_database.py
+++ b/Lib/packaging/tests/test_database.py
@@ -12,6 +12,7 @@ from hashlib import md5
from packaging.errors import PackagingError
from packaging.metadata import Metadata
from packaging.tests import unittest, run_unittest, support, TESTFN
+from packaging.tests.support import requires_zlib
from packaging.database import (
Distribution, EggInfoDistribution, get_distribution, get_distributions,
@@ -64,11 +65,13 @@ class CommonDistributionTests:
self.assertEqual(dist.version, version)
self.assertEqual(dist.metadata['Version'], version)
+ @requires_zlib
def test_repr(self):
dist = self.cls(self.dirs[0])
# just check that the class name is in the repr
self.assertIn(self.cls.__name__, repr(dist))
+ @requires_zlib
def test_comparison(self):
# tests for __eq__ and __hash__
dist = self.cls(self.dirs[0])
@@ -281,6 +284,7 @@ class TestDatabase(support.LoggingCatcher,
dirname = distinfo_dirname(name, version)
self.assertEqual(dirname, standard_dirname)
+ @requires_zlib
def test_get_distributions(self):
# Lookup all distributions found in the ``sys.path``.
# This test could potentially pick up other installed distributions
@@ -321,6 +325,7 @@ class TestDatabase(support.LoggingCatcher,
self.assertEqual(sorted(fake_dists), sorted(found_dists))
+ @requires_zlib
def test_get_distribution(self):
# Test for looking up a distribution by name.
# Test the lookup of the towel-stuff distribution
@@ -371,6 +376,7 @@ class TestDatabase(support.LoggingCatcher,
self.assertIsInstance(dist, Distribution)
self.assertEqual(dist.name, name)
+ @requires_zlib
def test_provides(self):
# Test for looking up distributions by what they provide
checkLists = lambda x, y: self.assertEqual(sorted(x), sorted(y))
@@ -437,6 +443,7 @@ class TestDatabase(support.LoggingCatcher,
use_egg_info=True)]
checkLists(l, [])
+ @requires_zlib
def test_obsoletes(self):
# Test looking for distributions based on what they obsolete
checkLists = lambda x, y: self.assertEqual(sorted(x), sorted(y))
@@ -465,6 +472,7 @@ class TestDatabase(support.LoggingCatcher,
l = [dist.name for dist in obsoletes_distribution('truffles', '0.2')]
checkLists(l, ['towel-stuff'])
+ @requires_zlib
def test_yield_distribution(self):
# tests the internal function _yield_distributions
checkLists = lambda x, y: self.assertEqual(sorted(x), sorted(y))