mirror of
https://github.com/python/cpython.git
synced 2025-11-11 02:52:04 +00:00
[3.14] GH-137426: Remove code deprecation of importlib.abc.ResourceLoader (GH-137567) (#137654)
Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
946b226b90
commit
daed07a1f9
4 changed files with 12 additions and 38 deletions
|
|
@ -224,15 +224,7 @@ class ResourceLoaderDefaultsTests(ABCTestHarness):
|
|||
SPLIT = make_abc_subclasses(ResourceLoader)
|
||||
|
||||
def test_get_data(self):
|
||||
with (
|
||||
self.assertRaises(IOError),
|
||||
self.assertWarnsRegex(
|
||||
DeprecationWarning,
|
||||
r"importlib\.abc\.ResourceLoader is deprecated in favour of "
|
||||
r"supporting resource loading through importlib\.resources"
|
||||
r"\.abc\.TraversableResources.",
|
||||
),
|
||||
):
|
||||
with self.assertRaises(IOError):
|
||||
self.ins.get_data('/some/path')
|
||||
|
||||
|
||||
|
|
@ -936,13 +928,8 @@ def get_filename(self, fullname):
|
|||
|
||||
def path_stats(self, path):
|
||||
return {'mtime': 1}
|
||||
with self.assertWarnsRegex(
|
||||
DeprecationWarning,
|
||||
r"importlib\.abc\.ResourceLoader is deprecated in favour of "
|
||||
r"supporting resource loading through importlib\.resources"
|
||||
r"\.abc\.TraversableResources.",
|
||||
):
|
||||
loader = DummySourceLoader()
|
||||
|
||||
loader = DummySourceLoader()
|
||||
|
||||
with self.assertWarnsRegex(
|
||||
DeprecationWarning,
|
||||
|
|
@ -952,17 +939,5 @@ def path_stats(self, path):
|
|||
loader.path_mtime('foo.py')
|
||||
|
||||
|
||||
class ResourceLoaderDeprecationWarningsTests(unittest.TestCase):
|
||||
"""Tests ResourceLoader deprecation warnings."""
|
||||
|
||||
def test_deprecated_resource_loader(self):
|
||||
from importlib.abc import ResourceLoader
|
||||
class DummyLoader(ResourceLoader):
|
||||
def get_data(self, path):
|
||||
return b''
|
||||
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
DummyLoader()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue