Issue 16803: Make test_importlib run tests under both _frozen_importlib and importlib._bootstrap (original) (raw)

Created on 2012-12-28 18:07 by brett.cannon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (17)
msg178409 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-12-28 18:07
Need to do some work on the importlib tests such that they get run using both _frozen_importlib and importlib._bootstrap to prevent any drift between importlib/_bootstrap.py and import.c (and to make it easier to develop).
msg179057 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-01-04 17:51
Is the usual PEP 399 idiom enough, or is something more advanced required?
msg179060 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-01-04 18:09
With some tricky use of import_fresh_module() because importlib.__init__ does some masking trickery, it should ... I think. =)
msg198953 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-10-04 14:15
It looks like as long as you block _frozen_importlib and do a fresh import of importlib you can make sure to use the source version of importlib._bootstrap instead of _frozen_importlib. >>> from test.support import import_fresh_module >>> mod = import_fresh_module('importlib.abc', fresh=('importlib',), blocked=('_frozen_importlib',)) >>> mod <module 'importlib.abc' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/abc.py'> >>> mod._bootstrap <module 'importlib._bootstrap' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/_bootstrap.py'> >>> mod._frozen_importlib >>> import importlib >>> importlib._bootstrap <module 'importlib._bootstrap' (frozen)> >>> mod2 = import_fresh_module('importlib', blocked=('_frozen_importlib',)) >>> mod2 <module 'importlib' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/__init__.py'> >>> mod2._bootstrap <module 'importlib._bootstrap' from '/Users/bcannon/Repositories/cpython/default/Lib/importlib/_bootstrap.py'>
msg198958 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-10-04 16:14
Turns out this isn't as clean-cut as simply using test.support.import_fresh_module() as you end up with different instances of importlib._bootstrap which kills any possible subclass checks, etc. between e.g. importlib.abc and importlib.machinery as the source versions will have different instances of importlib._bootstrap.
msg198960 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-04 18:47
New changeset f0416b2b5654 by Brett Cannon in branch 'default': Issue #16803: Run test.test_importlib.test_abc under both http://hg.python.org/cpython/rev/f0416b2b5654
msg200266 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-18 14:46
New changeset 9d96a3163dbf by Brett Cannon in branch 'default': Issue #16803: test.test_importlib.test_api now runs under frozen and http://hg.python.org/cpython/rev/9d96a3163dbf
msg200299 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-18 19:12
New changeset 66e219519279 by Brett Cannon in branch 'default': Issue #16803: Have test_importlib.test_locks use frozen and source http://hg.python.org/cpython/rev/66e219519279
msg200301 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-18 19:40
New changeset 862043d74fae by Brett Cannon in branch 'default': Issue #16803: Move test_importlib.test_util to use both frozen and http://hg.python.org/cpython/rev/862043d74fae
msg201252 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-25 16:34
New changeset becc0a488189 by Brett Cannon in branch 'default': Issue #16803: Stop having test.test_importlib.abc ABCs inherit from http://hg.python.org/cpython/rev/becc0a488189
msg201257 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-25 16:44
New changeset e2c3f638c3d0 by Brett Cannon in branch 'default': Issue #16803: Have test.test_importlib.builtin test both frozen and http://hg.python.org/cpython/rev/e2c3f638c3d0
msg201281 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-25 19:39
New changeset f3d50720dee0 by Brett Cannon in branch 'default': Issue #16803: Move test.test_importlib.extension to use both frozen and source importlib code http://hg.python.org/cpython/rev/f3d50720dee0
msg202432 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-08 16:10
New changeset b26e6e3e8037 by Brett Cannon in branch 'default': Issue #16803: test.test_importlib.frozen now runs both frozen and source code http://hg.python.org/cpython/rev/b26e6e3e8037
msg202440 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-08 18:35
New changeset 6c998d72553a by Brett Cannon in branch 'default': Issue #16803: test.test_importlib.import_ now tests frozen and source code http://hg.python.org/cpython/rev/6c998d72553a
msg202442 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-08 19:25
New changeset b0f570aef6fd by Brett Cannon in branch 'default': Issue #16803: test.test_importlib.source now tests frozen and source code http://hg.python.org/cpython/rev/b0f570aef6fd
msg202443 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-11-08 19:29
test_importlib now runs both frozen and source code for all relevant tests. Should allow for making changes in the source w/o recompiling and making sure any source tests pass. Also makes sure the pure Python implementation of import that mirrors what import.c does stays compatible.
msg202447 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2013-11-08 21:37
Hurray!
History
Date User Action Args
2022-04-11 14:57:39 admin set github: 61007
2013-11-08 21:37:02 eric.snow set messages: +
2013-11-08 19:29:26 brett.cannon set status: open -> closedtitle: Make test_import & test_importlib run tests under both _frozen_importlib and importlib._bootstrap -> Make test_importlib run tests under both _frozen_importlib and importlib._bootstrapmessages: + resolution: fixedstage: needs patch -> resolved
2013-11-08 19:25:46 python-dev set messages: +
2013-11-08 18:35:07 python-dev set messages: +
2013-11-08 16:10:48 python-dev set messages: +
2013-10-25 19:39:10 python-dev set messages: +
2013-10-25 16:44:43 python-dev set messages: +
2013-10-25 16:34:29 python-dev set messages: +
2013-10-18 19:40:39 python-dev set messages: +
2013-10-18 19:12:49 python-dev set messages: +
2013-10-18 14:46:27 python-dev set messages: +
2013-10-04 18:47:27 python-dev set nosy: + python-devmessages: +
2013-10-04 16:14:10 brett.cannon set messages: +
2013-10-04 14:15:54 brett.cannon set title: Make test_importlib run tests under both _frozen_importlib and importlib._bootstrap -> Make test_import & test_importlib run tests under both _frozen_importlib and importlib._bootstrap
2013-10-04 14:15:30 brett.cannon set messages: +
2013-06-22 00:43:40 brett.cannon set assignee: brett.cannon
2013-01-24 07:24:14 eric.snow set nosy: + eric.snow
2013-01-04 18:09:27 brett.cannon set messages: +
2013-01-04 17:51:28 ezio.melotti set nosy: + ezio.melottimessages: +
2012-12-31 13:45:40 brett.cannon set title: Make time_importlib run tests under both _frozen_importlib and importlib._bootstrap -> Make test_importlib run tests under both _frozen_importlib and importlib._bootstrap
2012-12-29 02:37:58 meador.inge set nosy: + meador.inge
2012-12-28 18:07:49 brett.cannon create