summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test
Commit message (Collapse)AuthorAgeFilesLines
* Issue #15168: Move importlb.test to test.test_importlib.Brett Cannon2012-07-2041-4547/+0
| | | | | This should make the Linux distros happy as it is now easier to leave importlib's tests out of their base Python distribution.
* Issue #15111: When a module was imported using a 'from import'Brett Cannon2012-07-101-14/+3
| | | | | | | statement (e.g. ``from distutils import msvc9compiler``) that triggers an ImportError of its own (e.g. the non-existence of winreg), let that exception propagate instead of raising a generic ImportError for the module being requested (e.g. msvc9compiler).
* Issue #15210: Greatly simplify the test for supporting importlibBrett Cannon2012-07-041-12/+5
| | | | | working without _frozen_importlib by moving to an import over a direct access in sys.modules.
* Issue #15210: If _frozen_importlib is not found in sys.modules byBrett Cannon2012-07-021-1/+22
| | | | importlib.__init__, then catch the KeyError raised, not ImportError.
* Closes #15030: Make importlib.abc.PyPycLoader respect the new .pycBrett Cannon2012-07-021-2/+6
| | | | | | | file size header field. Thanks to Marc Abramowitz and Ronan Lamy for helping out with various parts of the patch.
* Use assertIsNone. Thanks Terry Reedy.Eric V. Smith2012-06-289-11/+11
|
* Changed importlib tests to use assertIs, assertIsInstance, etc., instead of ↵Eric V. Smith2012-06-2714-58/+58
| | | | just assertTrue.
* Fixes issue 15039: namespace packages are no longer imported in preference ↵Eric V. Smith2012-06-241-1/+1
| | | | to modules of the same name.
* Prevent test_inspect from keeping alive a ton of frames and local variables ↵Antoine Pitrou2012-06-171-1/+1
| | | | | | by way of a global variable keeping a reference to a traceback. Should fix some buildbot failures.
* Issue #14938: importlib.abc.SourceLoader.is_package() now takes theBrett Cannon2012-06-161-2/+3
| | | | | | | | | module name into consideration when determining whether a module is a package or not. This prevents importing a module's __init__ module directly and having it considered a package, which can lead to duplicate sub-modules. Thanks to Ronan Lamy for reporting the bug.
* Whitespace cleanup.Eric V. Smith2012-05-251-4/+4
|
* issue 14660: Implement PEP 420, namespace packages.Eric V. Smith2012-05-252-26/+21
|
* Issue #9260: A finer-grained import lock.Antoine Pitrou2012-05-171-0/+115
| | | | | Most of the import sequence now uses per-module locks rather than the global import lock, eliminating well-known issues with threads and imports.
* Add importlib.util.resolve_name().Brett Cannon2012-05-131-1/+39
|
* Issue #13959: Introduce importlib.find_loader().Brett Cannon2012-05-121-1/+49
| | | | | | The long-term goal is to deprecate imp.find_module() in favour of this API, but it will take some time as some APIs explicitly return/use what imp.find_module() returns.
* Issue #13959: HaveBrett Cannon2012-05-112-5/+50
| | | | | | | | | | importlib.abc.FileLoader.load_module()/get_filename() and importlib.machinery.ExtensionFileLoader.load_module() have their single argument be optional as the loader's constructor has all the ncessary information. This allows for the deprecation of imp.load_source()/load_compile()/load_package().
* Issue #13959: Deprecate imp.get_suffixes() for new attributes onBrett Cannon2012-05-115-25/+24
| | | | | | | | | | | importlib.machinery that provide the suffix details for import. The attributes were not put on imp so as to compartmentalize everything importlib needs for setting up imports in importlib.machinery. This also led to an indirect deprecation of inspect.getmoduleinfo() as it directly returned imp.get_suffix's returned tuple which no longer makes sense.
* Issue #14764: Update importlib.test.benchmark to work in a world whereBrett Cannon2012-05-111-0/+14
| | | | import machinery is no longer implicit.
* Issue #14583: Fix importlib bug when a package's __init__.py would first ↵Antoine Pitrou2012-05-072-1/+61
| | | | import one of its modules then raise an error.
* Issue #13959: Re-implement imp.get_suffixes() in Lib/imp.py.Brett Cannon2012-05-046-10/+10
| | | | | | This introduces a new function, imp.extension_suffixes(), which is currently undocumented. That is forthcoming once issue #14657 is resolved and how to expose file suffixes is decided.
* Issue #14646: __import__() now sets __loader__ if need be.Brett Cannon2012-04-271-0/+28
| | | | | | importlib.util.module_for_loader also will set __loader__ along with __package__. This is in conjunction to a forthcoming update to PEP 302 which will make these two attributes required for loaders to set.
* Issue #14605: Use None in sys.path_importer_cache to represent noBrett Cannon2012-04-271-23/+5
| | | | finder instead of using some (now non-existent) implicit finder.
* Issue #14605: Stop having implicit entries for sys.meta_path.Brett Cannon2012-04-271-0/+18
| | | | ImportWarning is raised if sys.meta_path is found to be empty.
* Issue #14605: Make explicit the entries on sys.path_hooks that used toBrett Cannon2012-04-262-59/+27
| | | | | | | | | | | | be implicit. Added a warning for when sys.path_hooks is found to be empty. Also changed the meaning of None in sys.path_importer_cache to represent trying sys.path_hooks again (an interpretation of previous semantics). Also added a warning for when None was found. The long-term goal is for None in sys.path_importer_cache to represent the same as imp.NullImporter: no finder found for that sys.path entry.
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoader.Marc-Andre Lemburg2012-04-254-4/+4
| | | | | This time also recreating the Python/importlib.h file to make make happy. See the ticket for details.
* Issue #14605: Revert renaming of _SourcelessFileLoader, since it causedMarc-Andre Lemburg2012-04-254-4/+4
| | | | the buildbots to fail.
* Issue #14605: Rename _SourcelessFileLoader to SourcelessFileLoaderMarc-Andre Lemburg2012-04-244-4/+4
|
* Issue #14605: Expose importlib.abc.FileLoader andBrett Cannon2012-04-2210-29/+58
| | | | | | | | importlib.machinery.(FileFinder, SourceFileLoader, _SourcelessFileLoader, ExtensionFileLoader). This exposes all of importlib's mechanisms that will become public on the sys module.
* Issue #14585: test_import now runs all tests underBrett Cannon2012-04-201-0/+25
| | | | | importlib.test.import_ using builtins.__import__() instead of just the relative import tests.
* Have importlib.test.regrtest clear sys.path_importer_cache to makeBrett Cannon2012-04-201-0/+1
| | | | sure finders from importlib are used instead of _frozen_importlib.
* rollback 005fd1fe31ab (see #14609 and #14582)Benjamin Peterson2012-04-181-4/+28
| | | | | Being able to overload a sys.module entry during import of a module was broken by this changeset.
* Issue #12599: Be more strict in accepting None vs. a false-like objectBrett Cannon2012-04-182-1/+24
| | | | | | | in importlib. Thanks to PJE for pointing out the issue and Nick Coghlan for filing the bug.
* Issue #14592: A relative import will raise a KeyError if __package__Brett Cannon2012-04-171-0/+5
| | | | | | or __name__ are not set in globals. Thanks to Stefan Behnel for the bug report.
* Issue #14582: Import returns the module returned by a loader insteadBrett Cannon2012-04-151-28/+4
| | | | | | | | | | | | of sys.modules when possible. This is being done for two reasons. One is to gain a little bit of performance by skipping an unnecessary dict lookup in sys.modules. But the other (and main) reason is to be a little bit more clear in how things should work from the perspective of import's interactions with loaders. Otherwise loaders can easily forget to return the module even though PEP 302 explicitly states they are expected to return the module they loaded.
* Handle importing pkg.mod by executingBrett Cannon2012-04-151-0/+9
| | | | | __import__('mod', {'__packaging__': 'pkg', level=1) w/o properly (and thus not segfaulting).
* Issue #2377: Make importlib the implementation of __import__().Brett Cannon2012-04-148-22/+11
| | | | | | | importlib._bootstrap is now frozen into Python/importlib.h and stored as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen code along with sys and imp and then uses _frozen_importlib._install() to set builtins.__import__() w/ _frozen_importlib.__import__().
* Have importlib take advantage of ImportError's new 'name' and 'path'Brett Cannon2012-04-137-18/+39
| | | | attributes.
* Issue #14500: Fix importlib.test.import_.test_packages to clean upBrett Cannon2012-04-061-1/+5
| | | | after itself properly.
* If a module injects something into sys.modules as a side-effect ofBrett Cannon2012-04-031-0/+13
| | | | | | | | importation, then respect that injection. Discovered thanks to Lib/xml/parsers/expat.py injecting xml.parsers.expat.errors and etree now importing that directly as a module.
* Update importlib.invalidate_caches() to be more general.Brett Cannon2012-02-272-0/+35
|
* Make the benchmark recording more sensible for importlib.test.benchmark.Brett Cannon2012-02-241-29/+27
|
* Improper type for __package__ should raise TypeError, not ValueError.Brett Cannon2012-02-231-1/+1
|
* Issue #14043: Speed up importlib's _FileFinder by at least 8x, and add a new ↵Antoine Pitrou2012-02-201-2/+2
| | | | | | importlib.invalidate_caches() function. importlib is now often faster than imp.find_module() at finding modules.
* Fix importlib.test.__main__ to only worry about command-line flags when ↵Brett Cannon2012-02-171-8/+9
| | | | directly executed.
* Have importlib.test use argparse instead of some hacked up solution.Brett Cannon2012-02-171-3/+8
|
* Tweak the handling of the empty string in sys.path for importlib.Brett Cannon2012-02-161-1/+1
| | | | | | | It seems better to cache the finder for the cwd under its full path insetad of '' in case the cwd changes. Otherwise FileFinder needs to dynamically change itself based on whether it is given '' instead of caching a finder for every change to the cwd.
* importlib.__import__() now raises ValueError when level < 0.Brett Cannon2012-02-161-0/+7
| | | | | This is to bring it more in line with what PEP 328 set out to do with removing ambiguous absolute/relative import semantics.
* Use the cwd when the empty string is found in sys.path. This leads toBrett Cannon2012-02-081-0/+10
| | | | | __file__ being an absolute path when the module is found in the current directory.
* Re-order importlib benchmarks to be consistent. Also print out what ↵Brett Cannon2012-02-071-6/+8
| | | | implementation of __import__ is used.
* Have importlib.test.benchmark test with tabnanny as a medium-sized test.Brett Cannon2012-02-071-32/+58
|