From: Serhiy Storchaka Date: Mon, 17 Jun 2013 13:11:06 +0000 (+0300) Subject: Issue #18223: Refactor test_tarfile. X-Git-Tag: v3.4.0a1~466 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78be6e8aa3a0fec844bbc1af13b63826808f1f72;p=thirdparty%2FPython%2Fcpython.git Issue #18223: Refactor test_tarfile. * Use mixins for generating tests for different compression types. * Make test_tarfile discoverable. * Use more special tests (i.e. assertEqual, assertIs) instead of assertTrue. * Add explicit test skips instead of reporting skipped tests as passed. * Wrap long lines. * Correct a comment for test_hardlink_extraction1. * Add support.requires_gzip. * Replace ImportError by ModuleNotFoundError. and some other minor enhancements. --- 78be6e8aa3a0fec844bbc1af13b63826808f1f72 diff --cc Lib/test/support.py index be1c428c60f6,8db90a2a8cd7..5b7cfc2d49d5 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@@ -39,12 -39,17 +39,17 @@@ except ModuleNotFoundError try: import zlib -except ImportError: +except ModuleNotFoundError: zlib = None + try: + import gzip -except ImportError: ++except ModuleNotFoundError: + gzip = None + try: import bz2 -except ImportError: +except ModuleNotFoundError: bz2 = None try: diff --cc Lib/test/test_tarfile.py index a69437c796d6,238175ff3c1c..f3cb464f57a2 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@@ -14,16 -12,15 +12,15 @@@ from test import suppor # Check for our compression modules. try: import gzip - gzip.GzipFile - except (ImportError, AttributeError): -except ImportError: ++except ModuleNotFoundError: gzip = None try: import bz2 --except ImportError: ++except ModuleNotFoundError: bz2 = None try: import lzma --except ImportError: ++except ModuleNotFoundError: lzma = None def md5sum(data):