Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove more zlib checks #21

Open
wants to merge 1 commit into
base: always-require-zlib
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Doc/library/test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,6 @@ The :mod:`test.support` module defines the following functions:
Decorator for skipping tests on non-IEEE 754 platforms.


.. decorator:: requires_zlib

Decorator for skipping tests if :mod:`zlib` doesn't exist.


.. decorator:: requires_gzip

Decorator for skipping tests if :mod:`gzip` doesn't exist.
Expand Down
9 changes: 1 addition & 8 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"BasicTestRunner", "run_unittest", "run_doctest",
"requires_gzip", "requires_bz2", "requires_lzma",
"bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute",
"requires_IEEE_754", "requires_zlib",
"requires_IEEE_754",
"has_fork_support", "requires_fork",
"has_subprocess_support", "requires_subprocess",
"anticipate_failure", "load_package_tests", "detect_api_mismatch",
Expand Down Expand Up @@ -453,13 +453,6 @@ def dec(*args, **kwargs):
float.__getformat__("double").startswith("IEEE"),
"test requires IEEE 754 doubles")

def requires_zlib(reason='requires zlib'):
try:
import zlib
except ImportError:
zlib = None
return unittest.skipUnless(zlib, reason)

def requires_gzip(reason='requires gzip'):
try:
import gzip
Expand Down
11 changes: 0 additions & 11 deletions Lib/test/test_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,6 @@ class TestArchives(BaseTest, unittest.TestCase):

### shutil.make_archive

@support.requires_zlib()
def test_make_tarball(self):
# creating something to tar
root_dir, base_dir = self._create_files('')
Expand Down Expand Up @@ -1381,7 +1380,6 @@ def _create_files(self, base_dir='dist'):
write_file((root_dir, 'outer'), 'xxx')
return root_dir, base_dir

@support.requires_zlib()
@unittest.skipUnless(shutil.which('tar'),
'Need the tar command to run')
def test_tarfile_vs_tar(self):
Expand Down Expand Up @@ -1414,7 +1412,6 @@ def test_tarfile_vs_tar(self):
self.assertEqual(tarball, base_name + '.tar')
self.assertTrue(os.path.isfile(tarball))

@support.requires_zlib()
def test_make_zipfile(self):
# creating something to zip
root_dir, base_dir = self._create_files()
Expand Down Expand Up @@ -1451,7 +1448,6 @@ def test_make_zipfile(self):
['dist/', 'dist/sub/', 'dist/sub2/',
'dist/file1', 'dist/file2', 'dist/sub/file3'])

@support.requires_zlib()
@unittest.skipUnless(shutil.which('zip'),
'Need the zip command to run')
def test_zipfile_vs_zip(self):
Expand All @@ -1477,7 +1473,6 @@ def test_zipfile_vs_zip(self):
names2 = zf.namelist()
self.assertEqual(sorted(names), sorted(names2))

@support.requires_zlib()
@unittest.skipUnless(shutil.which('unzip'),
'Need the unzip command to run')
def test_unzip_zipfile(self):
Expand Down Expand Up @@ -1506,7 +1501,6 @@ def test_make_archive(self):
base_name = os.path.join(tmpdir, 'archive')
self.assertRaises(ValueError, make_archive, base_name, 'xxx')

@support.requires_zlib()
def test_make_archive_owner_group(self):
# testing make_archive with owner and group, with various combinations
# this works even if there's not gid/uid support
Expand All @@ -1533,8 +1527,6 @@ def test_make_archive_owner_group(self):
owner='kjhkjhkjg', group='oihohoh')
self.assertTrue(os.path.isfile(res))


@support.requires_zlib()
@unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
def test_tarfile_root_owner(self):
root_dir, base_dir = self._create_files()
Expand Down Expand Up @@ -1579,7 +1571,6 @@ def test_make_tarfile_in_curdir(self):
self.assertEqual(make_archive('test', 'tar'), 'test.tar')
self.assertTrue(os.path.isfile('test.tar'))

@support.requires_zlib()
def test_make_zipfile_in_curdir(self):
# Issue #21280
root_dir = self.mkdtemp()
Expand Down Expand Up @@ -1634,7 +1625,6 @@ def check_unpack_archive_with_converter(self, format, converter):
def test_unpack_archive_tar(self):
self.check_unpack_archive('tar')

@support.requires_zlib()
def test_unpack_archive_gztar(self):
self.check_unpack_archive('gztar')

Expand All @@ -1647,7 +1637,6 @@ def test_unpack_archive_bztar(self):
def test_unpack_archive_xztar(self):
self.check_unpack_archive('xztar')

@support.requires_zlib()
def test_unpack_archive_zip(self):
self.check_unpack_archive('zip')

Expand Down