Brett Cannon
1c1dcbfd5d
Trying to import a submodule from another module and not a package was raising
...
AttributeError in importlib when it should be an ImportError.
Found when running importlib against test_runpy.
2009-08-30 20:22:21 +00:00
Brett Cannon
de4ebfe559
When the globals argument to importlib.__import__() contained any value for
...
__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.
2009-08-30 19:53:48 +00:00
Brett Cannon
6afbaef2fd
Raise TypeError if the name given to importlib.__import__() lacks an rpartition
...
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.
2009-08-30 19:08:58 +00:00
Brett Cannon
44b28a9f32
Fix the importlib_only test decorator to work again; don't capture the flag variable as it might change later.
2009-08-30 18:59:21 +00:00
Brett Cannon
a6503606f9
Use the public API, not a private one.
2009-08-30 18:40:23 +00:00
Brett Cannon
9e0e1a63c8
Allow importlib.__import__ to accept any iterable for fromlist. Discovered when
...
running importlib against test___all__.
2009-08-30 18:28:46 +00:00
Brett Cannon
4d75fc1ce9
Have importlib raise ImportError if None is found in sys.modules. This matches
...
current import semantics.
2009-08-30 03:47:36 +00:00
Brett Cannon
2153dc001f
Move over to using assertRaises as a context manager for importlib tests.
...
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.
2009-08-27 23:49:21 +00:00
Brett Cannon
c5951fc996
Make __package__ setting tests specific to importlib. Also move to assertRaises context manager.
2009-08-27 23:46:38 +00:00
Brett Cannon
6d2bb7f5aa
Move a test-skipping decorator over to unittest.skipIf.
2009-08-27 23:44:18 +00:00
R. David Murray
9b2611ee40
Remove unused import for function that no longer exists.
2009-07-01 02:51:00 +00:00
Benjamin Peterson
c9c0f201fe
convert old fail* assertions to assert*
2009-06-30 23:06:06 +00:00
Raymond Hettinger
554290d920
Fixup/simplify another nested context manager.
2009-06-12 11:25:59 +00:00
Brett Cannon
8593a75688
Fix importlib.machinery.PathFinder.find_module() to essentially skip over None
...
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.
2009-03-30 19:57:15 +00:00
Brett Cannon
7aa21f75c1
A few more docstring/API cleanups for importlib.
2009-03-15 00:53:05 +00:00
Brett Cannon
ba3fcf17c8
Remove a dead XXX comment.
2009-03-09 01:58:13 +00:00
Brett Cannon
2dee597e05
Do some cleanup in importlib:
...
+ 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.
2009-02-21 03:15:37 +00:00
Brett Cannon
32732e3fbd
Change importlib.machinery.PathFinder to not have implicit semantics (that's
...
not handled by importlib._bootstrap._DefaultPathFinder).
2009-02-15 05:48:13 +00:00
Brett Cannon
2c318a1390
Rewrite the code implementing __import__ for importlib. Now it is much simpler
...
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).
2009-02-07 01:15:27 +00:00
Brett Cannon
6411aa5dd4
Finish implementing tests for importlib.machinery.PathFinder by testing that
...
implicit hooks are handled properly.
2009-02-06 00:07:49 +00:00
Brett Cannon
1f9bcd38a9
Add tests for using sys.path_hooks by importlib.machinery.PathFinder.
2009-02-05 23:36:02 +00:00
Brett Cannon
48f5c4eec6
Implement test for sys.path_importer_cache having None for
...
importlib.machinery.PathFinder.
2009-02-05 22:02:03 +00:00
Brett Cannon
939ea76b3c
Begin writing tests for importlib.machinery.PathFinder.
2009-02-05 02:53:23 +00:00
Brett Cannon
d720b36248
Move import semantic util code to importlib.test.import_.util.
2009-02-01 04:28:04 +00:00
Brett Cannon
bcb26c53c0
Rename importlib.test.support to importlib.test.util.
2009-02-01 04:00:05 +00:00
Brett Cannon
23cbd8a656
Add initial implementation of importlib. See the NOTES files for what is
...
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.
2009-01-18 00:24:28 +00:00