aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_importlib/test_abc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_importlib/test_abc.py')
-rw-r--r--Lib/test/test_importlib/test_abc.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
index 00af2dd7124..92a77e079e5 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -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 @@ class SourceLoaderDeprecationWarningsTests(unittest.TestCase):
def path_stats(self, path):
return {'mtime': 1}
-
- loader = DummySourceLoader()
- with self.assertWarns(DeprecationWarning):
+ 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()
+
+ with self.assertWarnsRegex(
+ DeprecationWarning,
+ r"SourceLoader\.path_mtime is deprecated in favour of "
+ r"SourceLoader\.path_stats\(\)\."
+ ):
loader.path_mtime('foo.py')