Brett Cannon
5c26eaad23
Add support for a --builtin argument to importlib.test to trigger running
...
import-specific tests with __import__ instead of importlib.
2009-08-27 23:49:56 +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
Georg Brandl
ab91fdef1f
Merged revisions 73715 via svnmerge from
...
svn+ssh://svn.python.org/python/branches/py3k
........
r73715 | benjamin.peterson | 2009-07-01 01:06:06 +0200 (Mi, 01 Jul 2009) | 1 line
convert old fail* assertions to assert*
........
2009-08-13 08:51:18 +00:00
Brett Cannon
6919427e94
Implement the PEP 302 protocol for get_filename() as
...
importlib.abc.ExecutionLoader. PyLoader now inherits from this ABC instead of
InspectLoader directly. Both PyLoader and PyPycLoader provide concrete
implementations of get_filename in terms of source_path and bytecode_path.
2009-07-20 04:23:48 +00:00
Brett Cannon
2e3155e2fe
Merged revisions 74107 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r74107 | brett.cannon | 2009-07-19 20:19:18 -0700 (Sun, 19 Jul 2009) | 8 lines
Importlib's documentation said that importlib.abc.PyLoader inherited from
importlib.abc.ResourceLoader, when in fact it did not. Fixed the ABC to inherit
as documented.
This does in introduce an backwards-incompatiblity as the code in PyLoader
already required the single method ResourceLoader defined as an abstract
method.
........
2009-07-20 03:22:43 +00:00
Brett Cannon
64ef00fa60
Importlib's documentation said that importlib.abc.PyLoader inherited from
...
importlib.abc.ResourceLoader, when in fact it did not. Fixed the ABC to inherit
as documented.
This doesn't introduce an backwards-incompatiblity as the code in PyLoader
already required the single method ResourceLoader defined as an abstract
method.
2009-07-20 03:19:18 +00:00
Brett Cannon
4dc3193973
Remove custom test-skipping code in importlib tests for unittest code.
2009-07-20 01:05:40 +00:00
Brett Cannon
10e35b30fb
Backport of r74103.
2009-07-20 00:19:49 +00:00
Brett Cannon
3c2738488a
Some tests in importlib.test.source.test_abc_loader were testing what happens
...
when a loader is given missing or bad code object bytecode. Unfortunately an
exception related to source paths was masking what the proper exception to test
should be. Making the test explicitly set the environment fixed the test.
The code being test was not affected.
2009-07-20 00:14:29 +00:00
Brett Cannon
0a49c58fb0
Update importlib.test.source.test_abc_loader to new features added in Python 3.1.
2009-07-19 23:43:45 +00:00
Brett Cannon
b49c70c7d3
Importlib was using custom code to discover all test modules in importlib.test.
...
This has now been removed in favor of using unittest's test discovery code in
TestLoader.discover().
2009-07-15 04:08:33 +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
1262e7c746
Tests for case-senstivity were not being skipped for darwin when installed on a
...
case-sensitive filesystems -- which is not the default case. Along the way also
fixed the skipping of tests when sys.dont_write_bytecode is true.
Closes issue #5442 again.
2009-05-11 01:47:11 +00:00
Benjamin Peterson
3c33b833dd
fix name again
2009-04-04 01:21:56 +00:00
Benjamin Peterson
3e0c9176fe
fix name
2009-04-04 00:46:15 +00:00
Benjamin Peterson
309633db08
fix naming
2009-04-03 23:47:26 +00:00
Benjamin Peterson
8d55a9e8dd
os.path.listdir -> os.listdir
2009-04-03 22:23:43 +00:00
Brett Cannon
5561982b64
importlib.test.source.test_abc_loader was making a bad assumption that all file
...
paths used '/' as a path separator.
Fixes issue #5646 .
2009-04-02 17:54:43 +00:00
Brett Cannon
f86213f6f2
Make a test in importlib have a more robust test value.
2009-04-02 15:35:09 +00:00
Brett Cannon
978259e9b3
Give a more informative message on an importlib test upon failure.
2009-04-02 15:32:07 +00:00
Brett Cannon
a3d056ed95
Check that on a platform that is expected to have a case-insensitive filesystem
...
that is in fact the case.
Closes issue #5442 .
2009-04-02 05:17:54 +00:00
Brett Cannon
12e533d7bf
Rip out a useless method that the superclass implements properly.
2009-04-01 03:35:20 +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
6ae7a7d13d
Add simple tests for __import__ for future optimizations to importlib.
2009-03-30 15:53:01 +00:00
Brett Cannon
e43b060b05
Document import's semantics for the language reference. This includes filling
...
in missing details for the sys module.
2009-03-21 03:11:16 +00:00
Brett Cannon
8d11013169
Implement InspectLoader for FrozenImporter.
2009-03-15 02:20:16 +00:00
Brett Cannon
a113ac58be
Implement InspectLoader for BuiltinImporter.
2009-03-15 01:41:33 +00:00
Brett Cannon
7aa21f75c1
A few more docstring/API cleanups for importlib.
2009-03-15 00:53:05 +00:00
Brett Cannon
0e0d8a63b1
Clean up docstring from importlib.util.module_for_loader.
2009-03-15 00:00:19 +00:00
Brett Cannon
f87e04d339
Finish properly hiding importlib implementation code.
2009-03-12 22:47:53 +00:00
Brett Cannon
e9103d2619
Last big re-organization of importlib._bootstrap. Should actually be able to find something in the file now.
2009-03-12 22:37:06 +00:00
Brett Cannon
ce43ddfee5
Do a little bit of reorganization on importlib._bootstrap.
2009-03-12 22:28:55 +00:00
Brett Cannon
3eeaa0a821
Make utility code in importlib._bootstrap private.
2009-03-12 22:07:17 +00:00
Brett Cannon
9495f182a0
Define importlib.__init__.__all__.
2009-03-12 22:01:40 +00:00
Brett Cannon
c59cd68847
Add a NOTE for importlib to fill in the docstrings for the ABCs.
2009-03-11 05:14:27 +00:00
Brett Cannon
2cf03a8204
Implement importlib.util.set_loader: a decorator to automatically set
...
__loader__ on modules.
2009-03-10 05:17:37 +00:00
Brett Cannon
d43b30b046
Implement get_source for importlib.abc.PyLoader using source_path and get_data.
2009-03-10 03:29:23 +00:00
Brett Cannon
e2085bedf1
Clean up importlib NOTES so it only contains short term goals.
2009-03-09 07:54:33 +00:00
Brett Cannon
2a922ed6ad
Introduce importlib.abc. The module contains various ABCs related to imports
...
(mostly stuff specified by PEP 302). There are two ABCs, PyLoader and
PyPycLoader, which help with implementing source and source/bytecode loaders by
implementing load_module in terms of other methods. This removes a lot of
gritty details loaders typically have to worry about.
2009-03-09 03:35:50 +00:00
Brett Cannon
ba3fcf17c8
Remove a dead XXX comment.
2009-03-09 01:58:13 +00:00
Brett Cannon
29dff8aada
Fix importlib._bootstrap.PyPycLoader.load_module() to better handle
...
source/bytecode paths and what to do when they don't exist.
2009-03-09 00:14:37 +00:00
Brett Cannon
f2b55fb5ee
Make importlib.test.source.util.write_bytecode reset sys.dont_write_bytecode.
2009-03-09 00:02:01 +00:00
Brett Cannon
1014d42dd3
Minor changes to Python source base loader.
...
Fixed a bug where 'self' was left off a method call. Was masked by the fact the
source/bytecode loader subclass is always used. Cleaned up when the source path
is fetched. Also made sure ImportError is raised when a source path cannot be
found.
2009-03-08 20:53:50 +00:00
Brett Cannon
79925fdbfe
Skip case-sensitivity tests for extension modules if _testcapi cannot be found.
2009-03-08 20:50:32 +00:00
Brett Cannon
435aad878c
Rename importlib.util.set___package__ to set_package.
2009-03-04 16:07:00 +00:00
Brett Cannon
7c9875c32c
Move importlib over to _io.
2009-03-04 01:10:09 +00:00