diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-11 23:12:38 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2008-05-11 23:12:38 (GMT) |
commit | 1fcaa77ac5a9cb09e014f2531a85561b9f7bed8c (patch) | |
tree | 6931dacf0e71a469887faa046b50ac2142781e34 /Lib/test | |
parent | f4e83deddaeaab237d2626986702d0c819d7f4c3 (diff) | |
download | cpython-1fcaa77ac5a9cb09e014f2531a85561b9f7bed8c.zip cpython-1fcaa77ac5a9cb09e014f2531a85561b9f7bed8c.tar.gz cpython-1fcaa77ac5a9cb09e014f2531a85561b9f7bed8c.tar.bz2 |
Revert commit r63086.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_py3kwarn.py | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 9db4fd8..85a772d 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -183,10 +183,9 @@ class TestStdlibRemovals(unittest.TestCase): class TestStdlibRenames(unittest.TestCase): - all_platforms = {'copy_reg': 'copyreg', 'Queue': 'queue'} - inclusive_platforms = {'mac': {'PixMapWrapper': 'pixmapwrapper'}} + renames = {'copy_reg': 'copyreg', 'Queue': 'queue'} - def check_rename(self, module_name, new_module_name, optional=False): + def check_rename(self, module_name, new_module_name): """Make sure that: - A DeprecationWarning is raised when importing using the old 2.x module name. @@ -202,32 +201,23 @@ class TestStdlibRenames(unittest.TestCase): except DeprecationWarning as exc: self.assert_(module_name in exc.args[0]) self.assert_(new_module_name in exc.args[0]) - except ImportError: - if not optional: - raise else: self.fail("DeprecationWarning not raised for %s" % module_name) with CleanImport(new_module_name): try: __import__(new_module_name, level=0) + except ImportError: + self.fail("cannot import %s with its 3.x name, %s" % + module_name, new_module_name) except DeprecationWarning: self.fail("unexpected DeprecationWarning raised for %s" % module_name) - except ImportError: - if not optional: - self.fail("cannot import %s with its 3.x name, %s" % - module_name, new_module_name) - def test_platform_independent_renames(self): - for module_name, new_module_name in self.all_platforms.items(): + def test_module_renames(self): + for module_name, new_module_name in self.renames.items(): self.check_rename(module_name, new_module_name) - def test_platform_specific_renames(self): - renames = self.inclusive_platforms.get(sys.platform, {}) - for module_name, new_module_name in renames.items(): - self.check_removal(module_name, new_module_name, optional=True) - def test_main(): run_unittest(TestPy3KWarnings, |