320 $ touch $TESTTMP/extlibroot/lsub1/__init__.py |
320 $ touch $TESTTMP/extlibroot/lsub1/__init__.py |
321 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py |
321 $ touch $TESTTMP/extlibroot/lsub1/lsub2/__init__.py |
322 |
322 |
323 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<EOF |
323 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/called.py <<EOF |
324 > def func(): |
324 > def func(): |
325 > return "this is extlibroot.lsub1.lsub2.called.func()" |
325 > return b"this is extlibroot.lsub1.lsub2.called.func()" |
326 > EOF |
326 > EOF |
327 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<EOF |
327 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/unused.py <<EOF |
328 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") |
328 > raise Exception("extlibroot.lsub1.lsub2.unused is loaded unintentionally") |
329 > EOF |
329 > EOF |
330 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<EOF |
330 $ cat > $TESTTMP/extlibroot/lsub1/lsub2/used.py <<EOF |
331 > detail = "this is extlibroot.lsub1.lsub2.used" |
331 > detail = b"this is extlibroot.lsub1.lsub2.used" |
332 > EOF |
332 > EOF |
333 |
333 |
334 Setup sub-package of "external library", which causes instantiation of |
334 Setup sub-package of "external library", which causes instantiation of |
335 demandmod in "recurse down the module chain" code path. Relative |
335 demandmod in "recurse down the module chain" code path. Relative |
336 importing with "absolute_import" feature isn't tested, because "level |
336 importing with "absolute_import" feature isn't tested, because "level |
337 >=1 " doesn't cause instantiation of demandmod. |
337 >=1 " doesn't cause instantiation of demandmod. |
338 |
338 |
339 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs |
339 $ mkdir -p $TESTTMP/extlibroot/recursedown/abs |
340 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<EOF |
340 $ cat > $TESTTMP/extlibroot/recursedown/abs/used.py <<EOF |
341 > detail = "this is extlibroot.recursedown.abs.used" |
341 > detail = b"this is extlibroot.recursedown.abs.used" |
342 > EOF |
342 > EOF |
343 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<EOF |
343 $ cat > $TESTTMP/extlibroot/recursedown/abs/__init__.py <<EOF |
344 > from __future__ import absolute_import |
344 > from __future__ import absolute_import |
345 > from extlibroot.recursedown.abs.used import detail |
345 > from extlibroot.recursedown.abs.used import detail |
346 > EOF |
346 > EOF |
347 |
347 |
348 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy |
348 $ mkdir -p $TESTTMP/extlibroot/recursedown/legacy |
349 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<EOF |
349 $ cat > $TESTTMP/extlibroot/recursedown/legacy/used.py <<EOF |
350 > detail = "this is extlibroot.recursedown.legacy.used" |
350 > detail = b"this is extlibroot.recursedown.legacy.used" |
351 > EOF |
351 > EOF |
352 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<EOF |
352 $ cat > $TESTTMP/extlibroot/recursedown/legacy/__init__.py <<EOF |
353 > # legacy style (level == -1) import |
353 > # legacy style (level == -1) import |
354 > from extlibroot.recursedown.legacy.used import detail |
354 > from extlibroot.recursedown.legacy.used import detail |
355 > EOF |
355 > EOF |
364 name. This leaves 'shadowing.used' pointing to 'used.detail', but still |
364 name. This leaves 'shadowing.used' pointing to 'used.detail', but still |
365 the submodule 'used' should be somehow accessible. (issue5617) |
365 the submodule 'used' should be somehow accessible. (issue5617) |
366 |
366 |
367 $ mkdir -p $TESTTMP/extlibroot/shadowing |
367 $ mkdir -p $TESTTMP/extlibroot/shadowing |
368 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<EOF |
368 $ cat > $TESTTMP/extlibroot/shadowing/used.py <<EOF |
369 > detail = "this is extlibroot.shadowing.used" |
369 > detail = b"this is extlibroot.shadowing.used" |
370 > EOF |
370 > EOF |
371 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<EOF |
371 $ cat > $TESTTMP/extlibroot/shadowing/proxied.py <<EOF |
372 > from __future__ import absolute_import |
372 > from __future__ import absolute_import |
373 > from extlibroot.shadowing.used import detail |
373 > from extlibroot.shadowing.used import detail |
374 > EOF |
374 > EOF |
384 $ touch $TESTTMP/absextroot/xsub1/__init__.py |
384 $ touch $TESTTMP/absextroot/xsub1/__init__.py |
385 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py |
385 $ touch $TESTTMP/absextroot/xsub1/xsub2/__init__.py |
386 |
386 |
387 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<EOF |
387 $ cat > $TESTTMP/absextroot/xsub1/xsub2/called.py <<EOF |
388 > def func(): |
388 > def func(): |
389 > return "this is absextroot.xsub1.xsub2.called.func()" |
389 > return b"this is absextroot.xsub1.xsub2.called.func()" |
390 > EOF |
390 > EOF |
391 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<EOF |
391 $ cat > $TESTTMP/absextroot/xsub1/xsub2/unused.py <<EOF |
392 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") |
392 > raise Exception("absextroot.xsub1.xsub2.unused is loaded unintentionally") |
393 > EOF |
393 > EOF |
394 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<EOF |
394 $ cat > $TESTTMP/absextroot/xsub1/xsub2/used.py <<EOF |
395 > detail = "this is absextroot.xsub1.xsub2.used" |
395 > detail = b"this is absextroot.xsub1.xsub2.used" |
396 > EOF |
396 > EOF |
397 |
397 |
398 Setup extension local modules to examine whether demand importing |
398 Setup extension local modules to examine whether demand importing |
399 works as expected in "level > 1" case. |
399 works as expected in "level > 1" case. |
400 |
400 |
401 $ cat > $TESTTMP/absextroot/relimportee.py <<EOF |
401 $ cat > $TESTTMP/absextroot/relimportee.py <<EOF |
402 > detail = "this is absextroot.relimportee" |
402 > detail = b"this is absextroot.relimportee" |
403 > EOF |
403 > EOF |
404 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<EOF |
404 $ cat > $TESTTMP/absextroot/xsub1/xsub2/relimporter.py <<EOF |
405 > from __future__ import absolute_import |
405 > from __future__ import absolute_import |
406 > from ... import relimportee |
406 > from ... import relimportee |
407 > detail = "this relimporter imports %r" % (relimportee.detail) |
407 > detail = b"this relimporter imports %r" % (relimportee.detail) |
408 > EOF |
408 > EOF |
409 |
409 |
410 Setup modules, which actually import extension local modules at |
410 Setup modules, which actually import extension local modules at |
411 runtime. |
411 runtime. |
412 |
412 |