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:
Hai Shi 2020-05-19 06:02:57 +08:00 committed by GitHub
parent ced4e5c227
commit a3ec3ad9e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 81 additions and 77 deletions

View file

@ -683,7 +683,7 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
self.doTest(".py", files, TESTMOD, comment=b"c" * ((1 << 16) - 1))
@support.requires_zlib
@support.requires_zlib()
class CompressedZipImportTestCase(UncompressedZipImportTestCase):
compression = ZIP_DEFLATED