diff options
author | Bénédikt Tran <10796600+picnixz@users.noreply.github.com> | 2024-11-01 16:35:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-01 16:35:22 (GMT) |
commit | 464a7a91d0c75241a2f1913e78dbfbc29d4193b4 (patch) | |
tree | 1e9d04bc545540f6eaa78976e2b4564fe922cfce /Lib/test/test_pkgutil.py | |
parent | 38a604fd90e765d5ac42373755397ab1e6cc0a39 (diff) | |
download | cpython-464a7a91d0c75241a2f1913e78dbfbc29d4193b4.zip cpython-464a7a91d0c75241a2f1913e78dbfbc29d4193b4.tar.gz cpython-464a7a91d0c75241a2f1913e78dbfbc29d4193b4.tar.bz2 |
gh-97850: remove ``find_loader`` and ``get_loader`` from ``pkgutil`` (#119656)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
Diffstat (limited to 'Lib/test/test_pkgutil.py')
-rw-r--r-- | Lib/test/test_pkgutil.py | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py index ca69275..736b837 100644 --- a/Lib/test/test_pkgutil.py +++ b/Lib/test/test_pkgutil.py @@ -607,73 +607,6 @@ class ImportlibMigrationTests(unittest.TestCase): # PEP 302 emulation in this module is in the process of being # deprecated in favour of importlib proper - @unittest.skipIf(__name__ == '__main__', 'not compatible with __main__') - @ignore_warnings(category=DeprecationWarning) - def test_get_loader_handles_missing_loader_attribute(self): - global __loader__ - this_loader = __loader__ - del __loader__ - try: - self.assertIsNotNone(pkgutil.get_loader(__name__)) - finally: - __loader__ = this_loader - - @ignore_warnings(category=DeprecationWarning) - def test_get_loader_handles_missing_spec_attribute(self): - name = 'spam' - mod = type(sys)(name) - del mod.__spec__ - with CleanImport(name): - try: - sys.modules[name] = mod - loader = pkgutil.get_loader(name) - finally: - sys.modules.pop(name, None) - self.assertIsNone(loader) - - @ignore_warnings(category=DeprecationWarning) - def test_get_loader_handles_spec_attribute_none(self): - name = 'spam' - mod = type(sys)(name) - mod.__spec__ = None - with CleanImport(name): - try: - sys.modules[name] = mod - loader = pkgutil.get_loader(name) - finally: - sys.modules.pop(name, None) - self.assertIsNone(loader) - - @ignore_warnings(category=DeprecationWarning) - def test_get_loader_None_in_sys_modules(self): - name = 'totally bogus' - sys.modules[name] = None - try: - loader = pkgutil.get_loader(name) - finally: - del sys.modules[name] - self.assertIsNone(loader) - - def test_get_loader_is_deprecated(self): - with check_warnings( - (r".*\bpkgutil.get_loader\b.*", DeprecationWarning), - ): - res = pkgutil.get_loader("sys") - self.assertIsNotNone(res) - - def test_find_loader_is_deprecated(self): - with check_warnings( - (r".*\bpkgutil.find_loader\b.*", DeprecationWarning), - ): - res = pkgutil.find_loader("sys") - self.assertIsNotNone(res) - - @ignore_warnings(category=DeprecationWarning) - def test_find_loader_missing_module(self): - name = 'totally bogus' - loader = pkgutil.find_loader(name) - self.assertIsNone(loader) - def test_get_importer_avoids_emulation(self): # We use an illegal path so *none* of the path hooks should fire with check_warnings() as w: |