summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] gh-99130: Apply bugfixes from importlib_metadata 4.11.4. (#99132)Jason R. Coombs2022-11-101-4/+6
|
* gh-95971: Turn @writes_bytecode_files to skip when not running (GH-95972)Miss Islington (bot)2022-10-151-1/+1
| | | | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 07b5c4699e64eb30c3bdcb1275c167e675d37423) Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
* test_threaded_import: Fix unittest.main spelling (GH-93114)Miss Islington (bot)2022-05-251-1/+1
| | | | | (cherry picked from commit 19710145b496b5e5341630d80be9c400aa792bd1) Co-authored-by: Florian Bruhin <me@the-compiler.org>
* [3.10] bpo-47004: Sync with importlib_metadata 4.11.3. (GH-31854). (GH-31857)Jason R. Coombs2022-03-131-0/+10
| | | | | (cherry picked from commit b1e286860742e7ba6fadc75e3ddb6c2899a56919) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-46246: add missing __slots__ to importlib.metadata.DeprecatedList (GH-30452)Miss Islington (bot)2022-02-111-0/+5
| | | | | | | | | | Confirmed with @jaraco that this indeed needs a fix. A question that came up while I was digging into the code: I think `SelectableGroups` could similarly use `__slots__ = ()`, since its purpose seems only for convenience around `dict`, not to have attributes of its own. Automerge-Triggered-By: GH:jaraco (cherry picked from commit dd76b3f7d332dd6eced5cbc2ad2adfc397700b3d) Co-authored-by: Arie Bovenberg <a.c.bovenberg@gmail.com>
* bpo-46616: Ensures test_importlib.test_windows cleans up registry keys after ↵Miss Islington (bot)2022-02-021-3/+14
| | | | | | | completion (GH-31086) (cherry picked from commit 89a0a90c2e0e685bc70206fc45e4413c4f4411ed) Co-authored-by: Steve Dower <steve.dower@python.org>
* [3.10] bpo-45703: Invalidate _NamespacePath cache on ↵Petr Viktorin2022-01-271-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | importlib.invalidate_cache (GH-29384) (GH-30922) Consider the following directory structure: . └── PATH1 └── namespace └── sub1 └── __init__.py And both PATH1 and PATH2 in sys path: $ PYTHONPATH=PATH1:PATH2 python3.11 >>> import namespace >>> import namespace.sub1 >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> ... While this interpreter still runs, PATH2/namespace/sub2 is created: . ├── PATH1 │ └── namespace │ └── sub1 │ └── __init__.py └── PATH2 └── namespace └── sub2 └── __init__.py The newly created module cannot be imported: >>> ... >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> import namespace.sub2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'namespace.sub2' Calling importlib.invalidate_caches() now newly allows to import it: >>> import importlib >>> importlib.invalidate_caches() >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace']) >>> import namespace.sub2 >>> namespace.__path__ _NamespacePath(['.../PATH1/namespace', '.../PATH2/namespace']) This was not previously possible.
* bpo-46105: Honor spec when generating requirement specs with urls and ↵Miss Islington (bot)2021-12-161-0/+2
| | | | | | | extras. (GH-30151) (cherry picked from commit 109d96602199a91e94eb14b8cb3720841f22ded7) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511)Łukasz Langa2021-09-211-1/+1
| | | | | | | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 8f943ca25732d548cf9f0b0393ba8d582fb93e29) Co-authored-by: Mohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com>
* [3.10] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28455)Serhiy Storchaka2021-09-192-19/+12
| | | | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests. (cherry picked from commit 40348acc180580371d25f75f46b27048e35f2435)
* Python 3.10.0rc1v3.10.0rc1Pablo Galindo2021-08-021-1/+1
|
* bpo-44784: Apply changes from importlib_metadata 4.6.3 (GH-27508) (#27510)Miss Islington (bot)2021-08-011-6/+12
| | | | | | | | | | Addressing issues with tests under error on warnings. Automerge-Triggered-By: GH:jaraco (cherry picked from commit 1cf8424a62db38a041d421a46618e025bbb87f89) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-44451: Reset DeprecationWarning filters in ↵Miss Islington (bot)2021-06-181-0/+1
| | | | | | | | | | | | | | | | | | | | test_importlib.test_entry_points_by_index (GH-26784) This avoids the following error if DeprecationWarnings are ignored. ====================================================================== ERROR: test_entry_points_by_index (test.test_importlib.test_metadata_api.APITests) Prior versions of Distribution.entry_points would return a ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.10.0b3/Lib/test/test_importlib/test_metadata_api.py", line 145, in test_entry_points_by_index expected = next(iter(caught)) StopIteration ---------------------------------------------------------------------- Ran 1402 tests in 2.125s FAILED (errors=1, skipped=18, expected failures=1) (cherry picked from commit df1502e47fc1e0cf1e7d460ae04530c3e2e4a7c6) Co-authored-by: Miro Hrončok <miro@hroncok.cz>
* [3.10] bpo-44246: Restore compatibility in entry_points (GH-26468) (GH-26471)Miss Islington (bot)2021-05-311-0/+16
| | | | | | | | | | | | | * [bpo-44246](): Entry points performance improvements. From importlib_metadata 4.3.1. * [bpo-44246](): Sync with importlib_metadata 4.4 (cherry picked from commit c34ed08d975fb7daa7b329f7c631647782290393) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Automerge-Triggered-By: GH:jaraco
* bpo-44246: Entry points performance improvements. (GH-26467)Miss Islington (bot)2021-05-311-0/+4
| | | | | | From importlib_metadata 4.3.1. (cherry picked from commit 410b70d39d9d77384f8b8597560f6731530149ca) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-38693: Prefer f-strings in importlib.resources (importlib_resources ↵Miss Islington (bot)2021-05-262-3/+3
| | | | | | | | | | 5.0.6). (GH-26387) (#26389) Automerge-Triggered-By: GH:jaraco (cherry picked from commit f6fbdb90ee450ad693f7a7809035d0dc968f98b7) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* [3.10] bpo-43643: Sync with python/importlib_resources@c17a610aad. ↵Miss Islington (bot)2021-05-211-0/+6
| | | | | | | | | | | | (GH-26284) (GH-26286) * [bpo-43643](): Sync with python/importlib_resources@c17a610aad. * Sync with python/importlib_resources@89fd5e961a. (cherry picked from commit 875b3d84b3072b2d3c352ad9f0ff52c441fbd12e) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Automerge-Triggered-By: GH:jaraco
* bpo-43926: Cleaner metadata with PEP 566 JSON support. (GH-25565)Jason R. Coombs2021-05-023-3/+37
| | | | | | | | | * bpo-43926: Cleaner metadata with PEP 566 JSON support. * Add blurb * Add versionchanged and versionadded declarations for changes to metadata. * Use descriptor for PEP 566
* bpo-43864: Silence deprecation warning in test_importlib.test_module_found ↵Shreyan Avigyan2021-04-271-2/+6
| | | | and test_importlib.test_module_not_found (GH-25656)
* bpo-43780: Sync with importlib_metadata 3.10 (GH-25297)Jason R. Coombs2021-04-242-0/+14
| | | | | | | * bpo-43780: Sync with importlib_metadata 3.10. * Add blurb * Apply changes from importlib_metadata 3.10.1.
* Silence find_module() DeprecationWarning on Windows tests (GH-25563)Brett Cannon2021-04-231-1/+4
|
* bpo-43105: Importlib now resolves relative paths when creating module spec ↵Steve Dower2021-04-072-4/+60
| | | | objects from file locations (GH-25121)
* bpo-42135: Deprecate implementations of find_module() and find_loader() ↵Brett Cannon2021-04-069-27/+44
| | | | (GH-25169)
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25181)Inada Naoki2021-04-058-15/+15
| | | | | | * Fix test_shutil * Fix test_imp * Fix test_import * Fix test_importlib
* bpo-43672: raise ImportWarning when calling find_loader() (GH-25119)Brett Cannon2021-04-028-92/+70
|
* bpo-42134: Raise ImportWarning when calling find_module() in the import ↵Brett Cannon2021-03-302-4/+14
| | | | system (GH-25044)
* bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)Brett Cannon2021-03-263-6/+29
|
* bpo-42137: have ModuleType.__repr__ prefer __spec__ over module_repr() ↵Brett Cannon2021-03-242-9/+2
| | | | | (GH-24953) This is to work towards the removal of the use of module_repr() in Python 3.12 (documented as deprecated since 3.4).
* bpo-43517: Fix false positive in detection of circular imports (#24895)Antoine Pitrou2021-03-203-1/+78
|
* bpo-43428: Sync with importlib_metadata 3.7. (GH-24782)Jason R. Coombs2021-03-134-13/+88
| | | | | | | * bpo-43428: Sync with importlib_metadata 3.7.2 (67234b6) * Add blurb * Reformat blurb to create separate paragraphs for each change included.
* bpo-42129: Add support for resources in namespaces (GH-24670)Jason R. Coombs2021-03-0413-102/+304
| | | | | * Unify behavior in ResourceReaderDefaultsTests and align with the behavior found in importlib_resources. * Equip NamespaceLoader with a NamespaceReader. * Apply changes from importlib_resources 5.0.4
* Fix failed merge of bpo-43288. (GH-24614)Neil Schemenauer2021-02-211-2/+3
|
* bpo-43288: Fix bug in test_importlib test. (GH-24612)Neil Schemenauer2021-02-211-0/+4
|
* bpo-42382: In importlib.metadata, `EntryPoint` objects now expose `dist` ↵Jason R. Coombs2020-12-314-80/+158
| | | | | | | | | | | | | | (#23758) * bpo-42382: In importlib.metadata, `EntryPoint` objects now expose a `.dist` object referencing the `Distribution` when constructed from a `Distribution`. Also, sync importlib_metadata 3.3: - Add support for package discovery under package normalization rules. - The object returned by `metadata()` now has a formally-defined protocol called `PackageMetadata` with declared support for the `.get_all()` method. * Add blurb * Remove latent footnote.
* bpo-26131: Deprecate usage of load_module() (GH-23469)Brett Cannon2020-12-0412-143/+254
| | | Raise an ImportWarning when the import system falls back on load_module(). As for implementations of load_module(), raise a DeprecationWarning.
* bpo-41490: ``path`` and ``contents`` to aggressively close handles (#22915)Jason R. Coombs2020-10-253-0/+79
| | | | | | | | | * bpo-41490: ``path`` method to aggressively close handles * Add blurb * In ZipReader.contents, eagerly evaluate the contents to release references to the zipfile. * Instead use _ensure_sequence to ensure any iterable from a reader is eagerly converted to a list if it's not already a sequence.
* bpo-42089: Sync with current cpython branch of importlib_metadata (GH-22775)Barry Warsaw2020-10-192-6/+15
| | | | | ~~The only differences are in the test files.~~ Automerge-Triggered-By: @jaraco
* bpo-40275: Fix failed test cases by using test helpers (GH-21811)Hai Shi2020-08-102-6/+6
|
* bpo-40275: Use new test.support helper submodules in tests (GH-21727)Hai Shi2020-08-0411-26/+32
|
* bpo-40275: Use new test.support helper submodules in tests (GH-21314)Hai Shi2020-07-061-2/+3
|
* bpo-40924: Ensure importlib.resources.path returns an extant path (GH-20857)Jason R. Coombs2020-06-291-0/+9
|
* bpo-41006: importlib.util no longer imports typing (GH-20938)Victor Stinner2020-06-171-2/+2
| | | | Create importlib._abc submodule to avoid importing typing when importlib.util is imported. Move Loader ABC into importlib._abc.
* bpo-39791: Support file systems that cannot support non-ascii filenames ↵Jason R. Coombs2020-06-072-2/+18
| | | | (skipping tests in that case). (#20681)
* bpo-39791: Refresh importlib.metadata from importlib_metadata 1.6.1. (GH-20659)Jason R. Coombs2020-06-053-10/+47
| | | | | | | * Refresh importlib.metadata from importlib_metadata 1.6.1. * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-272-7/+9
|
* bpo-40275: More lazy imports in test.support (GH-20131)Hai Shi2020-05-181-2/+2
| | | | | | | | | | | | | | | | | | | Make the the following imports lazy in test.support: * bz2 * gzip * lzma * resource * zlib The following test.support decorators now need to be called with parenthesis: * @support.requires_bz2 * @support.requires_gzip * @support.requires_lzma * @support.requires_zlib For example, "@requires_zlib" becomes "@requires_zlib()".
* bpo-39791: Add files() to importlib.resources (GH-19722)Jason R. Coombs2020-05-082-0/+40
| | | | | | | | | * bpo-39791: Update importlib.resources to support files() API (importlib_resources 1.5). * 📜🤖 Added by blurb_it. * Add some documentation about the new objects added. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* Clean up compatibility code in importlib fixtures (#19156)Jason R. Coombs2020-04-151-16/+2
|
* bpo-40029 mark test_importlib.test_zip as requiring zlib (#19105)Roman Yurchak2020-03-241-0/+4
| | | | | * bpo-40029 mark test_importlib.test_zip as requiring zlib * Decorate TestZip / TestEgg classes as requiring zlib
* bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738)Victor Stinner2020-03-171-23/+0
| | | | | | | | | | | | | Extension modules: m_traverse, m_clear and m_free functions of PyModuleDef are no longer called if the module state was requested but is not allocated yet. This is the case immediately after the module is created and before the module is executed (Py_mod_exec function). More precisely, these functions are not called if m_size is greater than 0 and the module state (as returned by PyModule_GetState()) is NULL. Extension modules without module state (m_size <= 0) are not affected. Co-Authored-By: Petr Viktorin <encukou@gmail.com>