summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-06-17 12:38:50 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-06-17 12:38:50 (GMT)
commit8b5629207944516a18834aec32e314b4aa4c09b2 (patch)
tree40be2e448a578f72aa25feed19e31dee83111f18 /Lib/test/support.py
parenta269d821a11f2f84e6a211818ac1fdd76e0ab647 (diff)
downloadcpython-8b5629207944516a18834aec32e314b4aa4c09b2.zip
cpython-8b5629207944516a18834aec32e314b4aa4c09b2.tar.gz
cpython-8b5629207944516a18834aec32e314b4aa4c09b2.tar.bz2
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. and some other minor enhancements.
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index bc5176a..8db90a2 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -43,6 +43,11 @@ except ImportError:
zlib = None
try:
+ import gzip
+except ImportError:
+ gzip = None
+
+try:
import bz2
except ImportError:
bz2 = None
@@ -71,7 +76,7 @@ __all__ = [
"TestHandler", "Matcher", "can_symlink", "skip_unless_symlink",
"skip_unless_xattr", "import_fresh_module", "requires_zlib",
"PIPE_MAX_SIZE", "failfast", "anticipate_failure", "run_with_tz",
- "requires_bz2", "requires_lzma", "suppress_crash_popup",
+ "requires_gzip", "requires_bz2", "requires_lzma", "suppress_crash_popup",
]
class Error(Exception):
@@ -588,6 +593,8 @@ requires_IEEE_754 = unittest.skipUnless(
requires_zlib = unittest.skipUnless(zlib, 'requires zlib')
+requires_gzip = unittest.skipUnless(gzip, 'requires gzip')
+
requires_bz2 = unittest.skipUnless(bz2, 'requires bz2')
requires_lzma = unittest.skipUnless(lzma, 'requires lzma')