summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/import_
Commit message (Collapse)AuthorAgeFilesLines
* #9424: Replace deprecated assert* methods in the Python test suite.Ezio Melotti2010-11-204-23/+23
|
* Make importlib.abc.SourceLoader the primary mechanism for importlib.Brett Cannon2010-07-031-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This required moving the class from importlib/abc.py into importlib/_bootstrap.py and jiggering some code to work better with the class. This included changing how the file finder worked to better meet import semantics. This also led to fixing importlib to handle the empty string from sys.path as import currently does (and making me wish we didn't support that instead just required people to insert '.' instead to represent cwd). It also required making the new set_data abstractmethod create any needed subdirectories implicitly thanks to __pycache__ (it was either this or grow the SourceLoader ABC to gain an 'exists' method and either a mkdir method or have set_data with no data arg mean to create a directory). Lastly, as an optimization the file loaders cache the file path where the finder found something to use for loading (this is thanks to having a sourceless loader separate from the source loader to simplify the code and cut out stat calls). Unfortunately test_runpy assumed a loader would always work for a module, even if you changed from underneath it what it was expected to work with. By simply dropping the previous loader in test_runpy so the proper loader can be returned by the finder fixed the failure. At this point importlib deviates from import on two points: 1. The exception raised when trying to import a file is different (import does an explicit file check to print a special message, importlib just says the path cannot be imported as if it was just some module name). 2. the co_filename on a code object is not being set to where bytecode was actually loaded from instead of where the marshalled code object originally came from (a solution for this has already been agreed upon on python-dev but has not been implemented yet; issue8611).
* Trying to import a submodule from another module and not a package was raisingBrett Cannon2009-08-301-0/+6
| | | | | | AttributeError in importlib when it should be an ImportError. Found when running importlib against test_runpy.
* When the globals argument to importlib.__import__() contained any value forBrett Cannon2009-08-301-7/+13
| | | | | | | | __package__, it was used. This was incorrect since it could be set to None to represent the fact that a proper value was unknown. Now None will trigger the calculation for __package__. Discovered when running importlib against test_importhooks.
* Raise TypeError if the name given to importlib.__import__() lacks an rpartitionBrett Cannon2009-08-301-0/+22
| | | | | | | | attribute. Was throwing AttributeError before. Discovered when running test_builtin against importlib. This exception change is specific to importlib.__import__() and does not apply to import_module() as it is being done for compatibility reasons only.
* Fix the importlib_only test decorator to work again; don't capture the flag ↵Brett Cannon2009-08-301-1/+3
| | | | variable as it might change later.
* Use the public API, not a private one.Brett Cannon2009-08-301-1/+1
|
* Allow importlib.__import__ to accept any iterable for fromlist. Discovered whenBrett Cannon2009-08-301-2/+9
| | | | running importlib against test___all__.
* Have importlib raise ImportError if None is found in sys.modules. This matchesBrett Cannon2009-08-301-4/+14
| | | | current import semantics.
* Move over to using assertRaises as a context manager for importlib tests.Brett Cannon2009-08-272-7/+10
| | | | | Obviously one shouldn't do whole sale conversions like this, but I was already going through the test code and I was bored at the airport.
* Make __package__ setting tests specific to importlib. Also move to ↵Brett Cannon2009-08-271-4/+5
| | | | assertRaises context manager.
* Move a test-skipping decorator over to unittest.skipIf.Brett Cannon2009-08-271-10/+3
|
* Remove unused import for function that no longer exists.R. David Murray2009-07-011-1/+0
|
* convert old fail* assertions to assert*Benjamin Peterson2009-06-306-31/+31
|
* Fixup/simplify another nested context manager.Raymond Hettinger2009-06-121-6/+3
|
* Fix importlib.machinery.PathFinder.find_module() to essentially skip over NoneBrett Cannon2009-03-301-0/+19
| | | | | | entries in sys.path_importer_cache. While this differs from semantics in how __import__ works, it prevents any implicit semantics from taking hold with users.
* A few more docstring/API cleanups for importlib.Brett Cannon2009-03-151-1/+1
|
* Remove a dead XXX comment.Brett Cannon2009-03-091-1/+0
|
* Do some cleanup in importlib:Brett Cannon2009-02-211-3/+3
| | | | | | | + Ditch using arguments to super(). + Ditch subclassing from object directly. + Move directory check out of chaining path hook to file path hook/finder. + Rename some classes to better reflect they are finders, not importers.
* Change importlib.machinery.PathFinder to not have implicit semantics (that'sBrett Cannon2009-02-152-34/+35
| | | | not handled by importlib._bootstrap._DefaultPathFinder).
* Rewrite the code implementing __import__ for importlib. Now it is much simplerBrett Cannon2009-02-074-148/+9
| | | | | | | | | and relies much more on meta path finders to abstract out various parts of import. As part of this the semantics for import_module tightened up and now follow __import__ much more closely (biggest thing is that the 'package' argument must now already be imported, else a SystemError is raised).
* Finish implementing tests for importlib.machinery.PathFinder by testing thatBrett Cannon2009-02-061-4/+19
| | | | implicit hooks are handled properly.
* Add tests for using sys.path_hooks by importlib.machinery.PathFinder.Brett Cannon2009-02-051-2/+10
|
* Implement test for sys.path_importer_cache having None forBrett Cannon2009-02-051-2/+14
| | | | importlib.machinery.PathFinder.
* Begin writing tests for importlib.machinery.PathFinder.Brett Cannon2009-02-051-1/+57
|
* Move import semantic util code to importlib.test.import_.util.Brett Cannon2009-02-018-56/+99
|
* Rename importlib.test.support to importlib.test.util.Brett Cannon2009-02-017-129/+124
|
* Add initial implementation of importlib. See the NOTES files for what isBrett Cannon2009-01-188-0/+799
planned for the package. There are no docs yet, but they are coming once the API for the first new function, importlib.import_module() is finalized.