mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-121604: fix warnings in test_importlib.test_abc and test_importlib.test_windows (GH-128904)
This commit is contained in:
parent
211f41316b
commit
27494dd9ad
2 changed files with 48 additions and 7 deletions
|
|
@ -226,7 +226,15 @@ class ResourceLoaderDefaultsTests(ABCTestHarness):
|
|||
SPLIT = make_abc_subclasses(ResourceLoader)
|
||||
|
||||
def test_get_data(self):
|
||||
with self.assertRaises(IOError):
|
||||
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.",
|
||||
),
|
||||
):
|
||||
self.ins.get_data('/some/path')
|
||||
|
||||
|
||||
|
|
@ -927,9 +935,19 @@ 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.assertWarns(DeprecationWarning):
|
||||
with self.assertWarnsRegex(
|
||||
DeprecationWarning,
|
||||
r"SourceLoader\.path_mtime is deprecated in favour of "
|
||||
r"SourceLoader\.path_stats\(\)\."
|
||||
):
|
||||
loader.path_mtime('foo.py')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue