Victor Stinner
14e461d5b9
Close #11619 : The parser and the import machinery do not encode Unicode
...
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Brett Cannon
7e0a18158f
Make test_import more robust and stop using assertRaisesRegexp().
2013-08-23 14:31:27 -04:00
Brett Cannon
a79e4fb38d
Issue #18342 : Use the repr of a module name for ``from ... import
...
...`` when an ImportError occurs.
Other cases had already been switched over to using the repr.
Thanks to Tomasz Maćkowiak for the patch.
2013-07-12 11:22:26 -04:00
Brett Cannon
7e5d55705c
merge for issue #18351 .
2013-07-06 18:04:41 -04:00
Brett Cannon
a53cca3fea
Issue #18351 : Fix various issues with
...
importlib._bootstrap._get_sourcefile().
Thanks to its only use by the C API, it was never properly tested
until now.
Thanks to Neal Norwitz for discovering the bug and Madison May for the patch.
2013-07-06 17:56:43 -04:00
Brett Cannon
fc4b5b9a42
Move test_import over to unittest.main().
2013-07-04 18:03:57 -04:00
Brett Cannon
679ecb565b
Issue #15767 : back out 8a0ed9f63c6e, finishing the removal of
...
ModuleNotFoundError.
2013-07-04 17:51:50 -04:00
Brett Cannon
e4f41deccf
Issue #17177 : The imp module is pending deprecation.
...
To make sure there is no issue with code that is both Python 2 and 3
compatible, there are no plans to remove the module any sooner than
Python 4 (unless the community moves to Python 3 solidly before then).
2013-06-16 13:13:40 -04:00
Brett Cannon
a3c96154d2
Issue #17907 : touch up the code for imp.new_module().
2013-06-14 22:26:30 -04:00
Brett Cannon
b1611e2772
Issue #15767 : Introduce ModuleNotFoundError, a subclass of
...
ImportError.
The exception is raised by import when a module could not be found.
Technically this is defined as no viable loader could be found for the
specified module. This includes ``from ... import`` statements so that
the module usage is consistent for all situations where import
couldn't find what was requested.
This should allow for the common idiom of::
try:
import something
except ImportError:
pass
to be updated to using ModuleNotFoundError and not accidentally mask
ImportError messages that should propagate (e.g. issues with a
loader).
This work was driven by the fact that the ``from ... import``
statement needed to be able to tell the difference between an
ImportError that simply couldn't find a module (and thus silence the
exception so that ceval can raise it) and an ImportError that
represented an actual problem.
2013-06-12 16:59:46 -04:00
Brett Cannon
997487d5d7
Issue #7732 : Move an imp.find_module test from test_import to
...
test_imp.
2013-06-07 13:26:53 -04:00
Benjamin Peterson
7d110042c5
raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ ( closes #17867 )
2013-04-29 09:08:14 -04:00
Nick Coghlan
f1465f0535
Close #17731 : Clean up properly in test_import
2013-04-15 22:56:51 +10:00
Ezio Melotti
e5e7a7cbf4
#11420 : merge with 3.2.
2013-03-16 21:49:20 +02:00
Ezio Melotti
c28f6fa505
#11420 : make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters.
2013-03-16 19:48:51 +02:00
Nick Coghlan
11d752e374
Remove unused import
2012-10-19 23:37:16 +10:00
Nick Coghlan
eb8d627bbd
Issue #6074 : Apply an appropriate fix for importlib based imports
2012-10-19 23:32:00 +10:00
Benjamin Peterson
d79ac0fad7
merge 3.2
2012-09-25 11:03:27 -04:00
Benjamin Peterson
d388c4e02f
use modern conditional syntax
2012-09-25 11:01:41 -04:00
Nick Coghlan
5d0612411e
Issue #15828 : Restore support for C extension modules in imp.load_module()
2012-09-01 00:13:45 +10:00
Nick Coghlan
a508770e20
Close #2501 : Permission bits are once again correctly copied from the source file to the cached bytecode file. Test by Eric Snow.
2012-08-24 18:32:40 +10:00
Brett Cannon
7385adc84c
Issue #15715 : Ignore failed imports triggered by the use of fromlist.
...
When the fromlist argument is specified for __import__() and the
attribute doesn't already exist, an import is attempted. If that fails
(e.g. module doesn't exist), the ImportError will now be silenced (for
backwards-compatibility). This *does not* affect
``from ... import ...`` statements.
Thanks to Eric Snow for the patch and Simon Feltman for reporting the
regression.
2012-08-17 13:21:16 -04:00
Nick Coghlan
336d9ac6bd
Issue #15425 : Don't rely on the assumption that the current working directory is on sys.path (this will hopefully appease the XP buildbots)
2012-07-31 21:39:42 +10:00
Nick Coghlan
42c0766a53
Close #15486 : Simplify the mechanism used to remove importlib frames from tracebacks when they just introduce irrelevant noise
2012-07-31 21:14:18 +10:00
Nick Coghlan
5ee9892406
Close #15425 : Eliminate more importlib related traceback noise
2012-07-29 20:30:36 +10:00
Jason R. Coombs
d0118e16a1
Restored test by specifying that the symlink links to a target (currently required for Windows symlinks). See issue15093 for details.
2012-07-26 15:21:17 -04:00
Brett Cannon
86ae981da9
Fix an import from the importlib.test move.
2012-07-20 15:40:57 -04:00
Brett Cannon
6ee9695270
Issue #15091 : Call importlib.invalidate_caches() and reactivate a test
...
of importing a symlinked package.
2012-07-20 14:22:04 -04:00
Brett Cannon
ba52586f76
Running the importlib tests from test_import is redundant as there is
...
no difference anymore between __import__ and importlib.__import__.
2012-07-20 14:01:34 -04:00
Nick Coghlan
be7e49fd82
Close #15386 : There was a loophole that meant importlib.machinery and imp would sometimes reference an uninitialised copy of importlib._bootstrap
2012-07-20 23:40:09 +10:00
Nick Coghlan
62b4136277
Fix broken test and replace redundant generator with a tuple
2012-10-20 00:03:46 +10:00
Nick Coghlan
c71b4c7198
Issue #6074 : Actually delete the source file in the test as intended
2012-10-19 23:38:36 +10:00
Nick Coghlan
34937ce249
Issue #6074 : Forward port Windows read-only source file fix from 2.7
2012-10-19 22:38:14 +10:00
Antoine Pitrou
c27ace688c
Issue #15338 : skip test_UNC_path when the current user doesn't have enough permissions to access the path.
2012-07-13 20:59:19 +02:00
Antoine Pitrou
68f4247b65
Issue #15338 : skip test_UNC_path when the current user doesn't have enough permissions to access the path.
2012-07-13 20:54:42 +02:00
Antoine Pitrou
5df0204091
For diagnosis, try to list the directory first
2012-07-12 19:50:03 +02:00
Antoine Pitrou
f189e80f23
Small improvements to test_unc_path
2012-07-12 19:48:49 +02:00
Antoine Pitrou
021548cf4c
Try to fix or diagnose buildbot failures
2012-07-12 19:21:43 +02:00
Antoine Pitrou
6803855ecf
Fix test failure under Windows
2012-07-08 13:16:15 +02:00
Antoine Pitrou
bc07a5c913
Issue #15110 : Fix the tracebacks generated by "import xxx" to not show the importlib stack frames.
2012-07-08 12:01:27 +02:00
Antoine Pitrou
d4daa87129
Properly cleanup pep3147 modules in test_import
2012-06-23 18:09:55 +02:00
Jason R. Coombs
42c9b04278
Prefer assertEqual to simply assert per recommendation in issue6727.
...
Clarified comment on disabled code to reference issue15093.
2012-06-20 10:24:24 -04:00
Antoine Pitrou
48114b952b
Issue #14657 : The frozen instance of importlib used for bootstrap is now also the module imported as importlib._bootstrap.
2012-06-17 22:33:38 +02:00
Jason R. Coombs
658dc3f746
Disable test on Unix. Causes buildbots to fail. See Issue #15091
2012-06-17 05:06:16 -04:00
Jason R. Coombs
71fde31da3
Adding test from issue6727 demonstrating that symlink import issue does not occur here in 3.3
2012-06-17 03:53:47 -04:00
Eric V. Smith
984b11f88f
issue 14660: Implement PEP 420, namespace packages.
2012-05-24 20:21:04 -04:00
Brett Cannon
b8c0206bd4
Issue #14637 : Fix the UNC import test under Windows to actually use
...
the UNC path. Also clean up sys.path and invalidate finder caches.
Thanks to Vinay Sajip for spotting the use of the wrong path.
2012-04-21 19:11:58 -04:00
Brett Cannon
9e924ed1ac
Fix a cleanup.
2012-04-20 17:34:59 -04:00
Brett Cannon
bbdc9cd3d2
Use a skipUnless decorator instead of conditional renaming.
2012-04-20 16:29:39 -04:00
Brett Cannon
1032af95ff
Issue #14585 : test_import now runs all tests under
...
importlib.test.import_ using builtins.__import__() instead of just the
relative import tests.
2012-04-20 15:52:17 -04:00