|
3 | 3 | import unittest |
4 | 4 | import shutil |
5 | 5 | import zipfile |
| 6 | + |
| 7 | +# zlib is not used here, but if it's not available |
| 8 | +# the tests that use zipfile may fail |
| 9 | +try: |
| 10 | + import zlib |
| 11 | +except ImportError: |
| 12 | + zlib = None |
| 13 | + |
6 | 14 | from os.path import join |
7 | 15 | import sys |
8 | 16 | import tempfile |
@@ -79,6 +87,7 @@ def _warn(*args): |
79 | 87 | cmd.warn = _warn |
80 | 88 | return dist, cmd |
81 | 89 |
|
| 90 | + @unittest.skipUnless(zlib, "requires zlib") |
82 | 91 | def test_prune_file_list(self): |
83 | 92 | # this test creates a package with some vcs dirs in it |
84 | 93 | # and launch sdist to make sure they get pruned |
@@ -120,6 +129,7 @@ def test_prune_file_list(self): |
120 | 129 | # making sure everything has been pruned correctly |
121 | 130 | self.assertEquals(len(content), 4) |
122 | 131 |
|
| 132 | + @unittest.skipUnless(zlib, "requires zlib") |
123 | 133 | def test_make_distribution(self): |
124 | 134 |
|
125 | 135 | # check if tar and gzip are installed |
@@ -156,6 +166,7 @@ def test_make_distribution(self): |
156 | 166 | self.assertEquals(result, |
157 | 167 | ['fake-1.0.tar', 'fake-1.0.tar.gz']) |
158 | 168 |
|
| 169 | + @unittest.skipUnless(zlib, "requires zlib") |
159 | 170 | def test_add_defaults(self): |
160 | 171 |
|
161 | 172 | # http://bugs.python.org/issue2279 |
@@ -217,6 +228,7 @@ def test_add_defaults(self): |
217 | 228 | manifest = open(join(self.tmp_dir, 'MANIFEST')).read() |
218 | 229 | self.assertEquals(manifest, MANIFEST % {'sep': os.sep}) |
219 | 230 |
|
| 231 | + @unittest.skipUnless(zlib, "requires zlib") |
220 | 232 | def test_metadata_check_option(self): |
221 | 233 | # testing the `medata-check` option |
222 | 234 | dist, cmd = self.get_cmd(metadata={}) |
|
0 commit comments