Skip to content

bpo-40275: lazy import module in test.supports' decorators - #20131

Merged
vstinner merged 4 commits into
python:masterfrom
shihai1991:bpo_40275_decorator
May 18, 2020
Merged

bpo-40275: lazy import module in test.supports' decorators#20131
vstinner merged 4 commits into
python:masterfrom
shihai1991:bpo_40275_decorator

Conversation

@shihai1991

@shihai1991shihai1991 commented May 16, 2020

Copy link
Copy Markdown
Member

@shihai1991

Copy link
Copy Markdown
MemberAuthor

@vstinner@serhiy-storchaka Hi, pls take a look if you have free time.

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @support.requires_zlib change works as expected:

vstinner@apu$ find -name "zlib*so" -delete
vstinner@apu$ ./python -m test -v test_zipfile
(...)
test_create_command (test.test_zipfile.CommandLineTest) ... skipped 'requires zlib'
(...)

Comment threadLib/test/support/__init__.py Outdated
@vstinner
vstinner merged commit a3ec3ad into python:masterMay 18, 2020
@vstinner

Copy link
Copy Markdown
Member

Thanks @shihai1991, I merged your PR. I rewrote your commit message to better describe what the commit does.

@shihai1991

Copy link
Copy Markdown
MemberAuthor

Thanks @shihai1991, I merged your PR. I rewrote your commit message to better describe what the commit does.

Oh, thanks, victor.

arturoescaip pushed a commit to arturoescaip/cpython that referenced this pull request May 24, 2020
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()".
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@shihai1991@vstinner@the-knights-who-say-ni@bedevere-bot