summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-04-29 04:06:49 (GMT)
committerGitHub <noreply@github.com>2017-04-29 04:06:49 (GMT)
commit3cc8259b71ef784a9f7593f04da96043afe2228a (patch)
tree4cdd166fc6ac83de4d8bc785f3eae365624e4215 /Lib/test/test_importlib
parent6c991bdee7ec4bedd8c1b8d3812dc884b654b57c (diff)
downloadcpython-3cc8259b71ef784a9f7593f04da96043afe2228a.zip
cpython-3cc8259b71ef784a9f7593f04da96043afe2228a.tar.gz
cpython-3cc8259b71ef784a9f7593f04da96043afe2228a.tar.bz2
bpo-30158: Fix deprecation warnings in test_importlib introduced by bpo-29576. (#1285)
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/test_abc.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
index db36204..54b2da6 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -157,15 +157,14 @@ class MetaPathFinderDefaultsTests(ABCTestHarness):
def test_find_module(self):
# Default should return None.
- self.assertIsNone(self.ins.find_module('something', None))
+ with self.assertWarns(DeprecationWarning):
+ found = self.ins.find_module('something', None)
+ self.assertIsNone(found)
def test_invalidate_caches(self):
# Calling the method is a no-op.
self.ins.invalidate_caches()
- def test_find_module_warns(self):
- with self.assertWarns(DeprecationWarning):
- self.ins.find_module('something', None)
(Frozen_MPFDefaultTests,
Source_MPFDefaultTests
@@ -183,7 +182,9 @@ class PathEntryFinderDefaultsTests(ABCTestHarness):
SPLIT = make_abc_subclasses(PathEntryFinder)
def test_find_loader(self):
- self.assertEqual((None, []), self.ins.find_loader('something'))
+ with self.assertWarns(DeprecationWarning):
+ found = self.ins.find_loader('something')
+ self.assertEqual(found, (None, []))
def find_module(self):
self.assertEqual(None, self.ins.find_module('something'))
@@ -192,9 +193,6 @@ class PathEntryFinderDefaultsTests(ABCTestHarness):
# Should be a no-op.
self.ins.invalidate_caches()
- def test_find_loader_warns(self):
- with self.assertWarns(DeprecationWarning):
- self.ins.find_loader('something')
(Frozen_PEFDefaultTests,
Source_PEFDefaultTests
@@ -324,7 +322,8 @@ class MetaPathFinderFindModuleTests:
finder = self.finder(None)
path = ['a', 'b', 'c']
name = 'blah'
- found = finder.find_module(name, path)
+ with self.assertWarns(DeprecationWarning):
+ found = finder.find_module(name, path)
self.assertIsNone(found)
self.assertEqual(name, finder.called_for[0])
self.assertEqual(path, finder.called_for[1])
@@ -333,7 +332,8 @@ class MetaPathFinderFindModuleTests:
loader = object()
spec = self.util.spec_from_loader('blah', loader)
finder = self.finder(spec)
- found = finder.find_module('blah', None)
+ with self.assertWarns(DeprecationWarning):
+ found = finder.find_module('blah', None)
self.assertIs(found, spec.loader)
@@ -358,7 +358,8 @@ class PathEntryFinderFindLoaderTests:
def test_no_spec(self):
finder = self.finder(None)
name = 'blah'
- found = finder.find_loader(name)
+ with self.assertWarns(DeprecationWarning):
+ found = finder.find_loader(name)
self.assertIsNone(found[0])
self.assertEqual([], found[1])
self.assertEqual(name, finder.called_for)
@@ -367,7 +368,8 @@ class PathEntryFinderFindLoaderTests:
loader = object()
spec = self.util.spec_from_loader('blah', loader)
finder = self.finder(spec)
- found = finder.find_loader('blah')
+ with self.assertWarns(DeprecationWarning):
+ found = finder.find_loader('blah')
self.assertIs(found[0], spec.loader)
def test_spec_with_portions(self):
@@ -375,7 +377,8 @@ class PathEntryFinderFindLoaderTests:
paths = ['a', 'b', 'c']
spec.submodule_search_locations = paths
finder = self.finder(spec)
- found = finder.find_loader('blah')
+ with self.assertWarns(DeprecationWarning):
+ found = finder.find_loader('blah')
self.assertIsNone(found[0])
self.assertEqual(paths, found[1])