summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
Commit message (Collapse)AuthorAgeFilesLines
* [3.5] Backport bpo-30876 (GH-2639), bpo-18018 and bpo-26367. (#2677)Serhiy Storchaka2017-07-232-2/+7
| | | | | | | | | | | | | | | | * bpo-30876: Relative import from unloaded package now reimports the package instead of failing with SystemError. Relative import from non-package now fails with ImportError rather than SystemError. (cherry picked from commit 8a9cd20edca7d01b68292036029ae3735ce65edd) * bpo-18018: Import raises ImportError instead of SystemError if a relative import is attempted without a known parent package. * bpo-26367: importlib.__init__() raises ImportError like builtins.__import__() when ``level`` is specified but without an accompanying package specified.
* [3.5] bpo-29514: Check magic number for bugfix releases (#2158)Nick Coghlan2017-06-131-0/+44
| | | | | | | | | | | | Add a test to check the current MAGIC_NUMBER against the expected number for the release if the current release is at candidate or final level. On test failure, describe to the developer the procedure for changing the magic number. This ensures that pre-merge CI will automatically pick up on magic number changes in maintenance releases (and explain why those are problematic), rather than relying on all core developers to be aware of the implications of such changes.
* [3.5] bpo-29537: Tolerate legacy invalid bytecode (#169)Nick Coghlan2017-03-081-0/+104
| | | | | | | | | | | | | | | | | | bpo-27286 fixed a problem where BUILD_MAP_UNPACK_WITH_CALL could be emitted with an incorrect oparg value, causing the eval loop to access the wrong stack entry when attempting to read the function name. The associated magic number change caused significant problems when attempting to upgrade to 3.5.3 for anyone that relies on pre-cached bytecode remaining valid across maintenance releases. This patch restores the ability to import legacy bytecode generated by 3.5.0, 3.5.1 or 3.5.2, and modifies the eval loop to avoid any harmful consequences from the potentially malformed legacy bytecode. Original import patch by Petr Viktorin, eval loop patch by Serhiy Storchaka, and tests and integration by Nick Coghlan.
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Martin Panter2016-09-071-1/+1
|
* [backport to 3.5] - issue26896 - Disambiguate uses of "importer" with "finder".Senthil Kumaran2016-09-072-2/+0
|
* Issue #27782: Fix m_methods handling in multiphase initNick Coghlan2016-08-211-0/+9
| | | | | | | | Multi-phase extension module import now correctly allows the ``m_methods`` field to be used to add module level functions to instances of non-module types returned from ``Py_create_mod``. Patch by Xiang Zhang.
* Fix regressions introduced by fixes for issue #27083.Brett Cannon2016-07-163-18/+18
|
* Issue #27083: Respect the PYTHONCASEOK environment variable underBrett Cannon2016-07-151-6/+9
| | | | | | | | | | Windows. Originally only b'PYTHONCASEOK' was being checked for in os.environ, but that won't work under Windows where all environment variables are strings (on OS X they are bytes). Thanks to Eryk Sun for the bug report.
* Fix a scoping issue where an UnboundLocalError was triggered if aBrett Cannon2016-06-251-3/+13
| | | | lazy-loaded module was already in sys.modules.
* Issue #26581: Use the first coding cookie on a line, not the last one.Serhiy Storchaka2016-03-201-1/+1
|
* Issue #26186: Remove an invalid type check inBrett Cannon2016-02-211-0/+1
| | | | | | | | | | | importlib.util.LazyLoader. The class was checking its argument as to whether its implementation of create_module() came directly from importlib.abc.Loader. The problem is that the classes coming from imoprtlib.machinery do not directly inherit from the ABC as they come from _frozen_importlib. Because the documentation has always said that create_module() was ignored, the check has simply been removed.
* Issue #26367: Have importlib.__init__() raise RuntimeError whenBrett Cannon2016-02-201-0/+5
| | | | | | | 'level' is specified but no __package__. This brings the function inline with builtins.__import__(). Thanks to Manuel Jacob for the patch.
* Issue #25595: Fixed test_deleted_cwd in test_importlib on AIX.Serhiy Storchaka2015-11-111-8/+14
|
* use assert method in another placeBenjamin Peterson2015-05-301-1/+1
|
* use assert method (#24328)Benjamin Peterson2015-05-291-1/+1
|
* fix importing one char extension modules (closes #24328)Benjamin Peterson2015-05-291-0/+8
|
* Issue #24285: fix importing extensions from packagesNick Coghlan2015-05-261-0/+7
|
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-0/+167
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* Issue #15836: assertRaises(), assertRaisesRegex(), assertWarns() andSerhiy Storchaka2015-05-211-1/+0
| | | | | assertWarnsRegex() assertments now check the type of the first argument to prevent possible user error. Based on patch by Daniel Wagner-Hall.
* Issue #24192: Fix namespace package imports.Eric Snow2015-05-161-1/+1
|
* Issue #23911: Move path-based bootstrap code to a separate frozen module.Eric Snow2015-05-033-6/+6
|
* Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-18/+96
| | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* Remove a dead test for a never-launched APIBrett Cannon2015-03-271-9/+0
|
* Issue #22834: Drop a redundant comment and use errno instead of anBrett Cannon2015-02-271-2/+2
| | | | | | integer. Thanks to Serhiy Storchaka and Martin Panter for the suggestions.
* Issue #22834: Fix a failing test under Solaris due to the platform notBrett Cannon2015-02-201-2/+8
| | | | | | allowing the deletion of the cwd. Thanks to Martin Panter for the initial fix.
* Issue #23014: Make importlib.abc.Loader.create_module() required whenBrett Cannon2015-01-094-3/+19
| | | | | | | | | importlib.abc.Loader.exec_module() is also defined. Before this change, create_module() was optional **and** could return None to trigger default semantics. This change now reduces the options for choosing default semantics to one and in the most backporting-friendly way (define create_module() to return None).
* #22980 Adds platform and version tags to .pyd filesSteve Dower2014-12-161-0/+24
|
* Issue #22834: cwd can't not exist on Windows, skip the testZachary Ware2014-11-221-0/+1
|
* Issue #22834: Have import suppress FileNotFoundError when the currentBrett Cannon2014-11-211-0/+12
| | | | | | working directory no longer exists. Thanks to Martin Panter for the bug report.
* Issue #19714: Tests for importlib.machinery.WindowsRegistryFinder.Brett Cannon2014-08-221-2/+63
| | | | Patch by Claudiu Popa, review by Martin v. Löwis.
* Closes #22002: Merge with 3.4Zachary Ware2014-07-2312-97/+45
|\
| * Issue #22002: Make full use of test discovery in test sub-packages.Zachary Ware2014-07-2312-97/+45
| | | | | | | | | | | | Adds `load_package_tests` function to test.support, uses it in test_asyncio, test_email, test_json, test_tools, test_importlib and all test_importlib sub-packages to implement test discovery.
* | Issue #19593: Use specific asserts in importlib tests.Serhiy Storchaka2014-07-074-4/+4
|\ \ | |/
| * Issue #19593: Use specific asserts in importlib tests.Serhiy Storchaka2014-07-074-4/+4
| |
* | Issue #21755: Skip {Frozen,Source}_DeadlockAvoidanceTests tests whenBerker Peksag2014-07-031-66/+78
| | | | | | | | Python is built without threads.
* | Issue #20383: Introduce importlib.util.module_from_spec().Brett Cannon2014-05-302-197/+142
| | | | | | | | | | | | Along the way, dismantle importlib._bootstrap._SpecMethods as it was no longer relevant and constructing the new function required partially dismantling the class anyway.
* | Issue 21137: Better repr for threading.Lock()Raymond Hettinger2014-05-261-0/+3
| |
* | Issue #21503: Use test_both() consistently in test_importlib.Eric Snow2014-05-1629-429/+525
| |
* | Fix a small typo in test_importlib.Eric Snow2014-05-161-2/+2
| |
* | Merge from 3.4 (for #21499).Eric Snow2014-05-131-7/+8
|\ \ | |/
| * Issue #21499: Ignore __builtins__ in several test_importlib.test_api tests.Eric Snow2014-05-131-7/+8
| |
| * Issue #21097: Move test_namespace_pkgs into test_importlib.Eric Snow2014-03-2915-0/+302
| |
* | Issue #19721: Consolidate test_importlib utility code into a singleBrett Cannon2014-05-0925-270/+249
| | | | | | | | module.
* | Issue #20776: Flesh out tests for importlib.machinery.PathFinder.Brett Cannon2014-05-091-0/+47
| |
* | Issue #17621: Introduce importlib.util.LazyLoader.Brett Cannon2014-04-041-0/+132
| |
* | Issue #21097: Move test_namespace_pkgs into test_importlib.Eric Snow2014-03-2915-0/+302
|/
* merge 3.3 (#20796)Benjamin Peterson2014-02-271-0/+1
|\
| * fix importlib test failure when bytecode writing is disabled (closes #20796)Benjamin Peterson2014-02-271-0/+1
| | | | | | | | Patch by Berker Peksag.
| * Issue #19596: Set untestable tests in test_importlib to NoneZachary Ware2013-11-196-55/+26
| | | | | | | | to avoid reporting success on empty tests.
* | Issue #20763: Fix importlib.machinery.PathFinder to supportBrett Cannon2014-02-261-0/+24
| | | | | | | | | | | | PathEntryFinder instances which only define find_module(). Reported by Yukihiro Nakadaira.