diff options
author | Thomas Grainger <tagrain@gmail.com> | 2025-01-16 21:29:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-16 13:29:16 -0800 |
commit | 27494dd9ad6032c29e273cd7f45c204c00d6512c (patch) | |
tree | 8e4b197649563a09f7b744c6604f1f2b40105121 /Lib/test/test_importlib/test_abc.py | |
parent | 211f41316b7f205d18eb65c1ececd7f7fb30b02d (diff) | |
download | cpython-27494dd9ad6032c29e273cd7f45c204c00d6512c.tar.gz cpython-27494dd9ad6032c29e273cd7f45c204c00d6512c.zip |
gh-121604: fix warnings in test_importlib.test_abc and test_importlib.test_windows (GH-128904)
Diffstat (limited to 'Lib/test/test_importlib/test_abc.py')
-rw-r--r-- | Lib/test/test_importlib/test_abc.py | 26 |
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') |