classification
Title: Use test_both() consistently throughout test_importlib
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.snow Nosy List: brett.cannon, eric.snow, python-dev
Priority: low Keywords: patch

Created on 2014-05-14 00:25 by eric.snow, last changed 2014-05-16 17:46 by eric.snow. This issue is now closed.

Files
File name Uploaded Description Edit
use-test_both-consistently.diff eric.snow, 2014-05-14 00:25 review
Messages (5)
msg218494 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2014-05-14 00:25
test_importlib.util provides the test_both() function that facilitates testing both the frozen and source versions of importlib.  The function helps to keep the tests more maintainable.  However, the following test modules are not using test_both():

Lib/test/test_importlib/test_abc.py
Lib/test/test_importlib/test_api.py
Lib/test/test_importlib/test_locks.py
Lib/test/test_importlib/test_spec.py
Lib/test/test_importlib/test_windows.py

Furthermore, the remaining test modules use test_both() inconsistently.  Here is a patch that makes consistent use of test_both() and formats usage in a way that helps with readability.
msg218666 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-05-16 14:57
I see you noticed my shift in strategy after I realized part way through a cleaner way of doing things. =)

LGTM

I don't love the formatting of the test_both() lines, but I think that one is just an aesthetic thing that will never make people happy -- weird line wrapping or really long lines -- so just leave it as-is in your patch.
msg218669 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2014-05-16 15:19
> I don't love the formatting of the test_both() lines, but I think that one is just an aesthetic thing that will never make people happy -- weird line wrapping or really long lines -- so just leave it as-is in your patch.

Yeah, I went with the formatting that I did because I found it a
little easier to follow (stronger separation between elements) and
visually distinguish in the code.  It was also a little easier to
grep/search for.
msg218672 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2014-05-16 15:30
FWIW, this change was motivated by the importlib backport (I found some time to work on it).  The import_importlib()/test_both() approach definitely makes backporting the tests easier (thanks for that).

BTW, thanks for also consolidating the various test_importlib util modules.  That also helped.
msg218676 - (view) Author: Roundup Robot (python-dev) Date: 2014-05-16 17:45
New changeset 34d65746d5ca by Eric Snow in branch 'default':
Issue #21503: Use test_both() consistently in test_importlib.
http://hg.python.org/cpython/rev/34d65746d5ca
History
Date User Action Args
2014-05-16 17:46:12eric.snowsetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2014-05-16 17:45:12python-devsetnosy: + python-dev
messages: + msg218676
2014-05-16 15:30:22eric.snowsetmessages: + msg218672
2014-05-16 15:19:55eric.snowsetmessages: + msg218669
2014-05-16 14:57:31brett.cannonsetmessages: + msg218666
2014-05-14 00:25:29eric.snowcreate