mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
bpo-40275: More lazy imports in test.support (GH-20131)
Make the the following imports lazy in test.support: * bz2 * gzip * lzma * resource * zlib The following test.support decorators now need to be called with parenthesis: * @support.requires_bz2 * @support.requires_gzip * @support.requires_lzma * @support.requires_zlib For example, "@requires_zlib" becomes "@requires_zlib()".
This commit is contained in:
parent
ced4e5c227
commit
a3ec3ad9e2
10 changed files with 81 additions and 77 deletions
|
|
@ -57,21 +57,21 @@ class TarTest:
|
|||
def mode(self):
|
||||
return self.prefix + self.suffix
|
||||
|
||||
@support.requires_gzip
|
||||
@support.requires_gzip()
|
||||
class GzipTest:
|
||||
tarname = gzipname
|
||||
suffix = 'gz'
|
||||
open = gzip.GzipFile if gzip else None
|
||||
taropen = tarfile.TarFile.gzopen
|
||||
|
||||
@support.requires_bz2
|
||||
@support.requires_bz2()
|
||||
class Bz2Test:
|
||||
tarname = bz2name
|
||||
suffix = 'bz2'
|
||||
open = bz2.BZ2File if bz2 else None
|
||||
taropen = tarfile.TarFile.bz2open
|
||||
|
||||
@support.requires_lzma
|
||||
@support.requires_lzma()
|
||||
class LzmaTest:
|
||||
tarname = xzname
|
||||
suffix = 'xz'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue