diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-24 23:28:56 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-24 23:28:56 (GMT) |
commit | e0511e797c483e1203a096ff96e34dc95368f843 (patch) | |
tree | 87119aaa53c9eb7d0d85023f9914a39cafb8ace3 /Lib/test/test_warnings | |
parent | 1129084ebde17f78af19ff593d67b6fe37e53321 (diff) | |
download | cpython-e0511e797c483e1203a096ff96e34dc95368f843.zip cpython-e0511e797c483e1203a096ff96e34dc95368f843.tar.gz cpython-e0511e797c483e1203a096ff96e34dc95368f843.tar.bz2 |
Fix test_warnings.test_improper_option()
test_warnings: only run test_improper_option() and test_warnings_bootstrap()
once. The unit test doesn't depend on self.module.
Diffstat (limited to 'Lib/test/test_warnings')
-rw-r--r-- | Lib/test/test_warnings/__init__.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index cea9c57..eda755d 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -534,6 +534,14 @@ class WCmdLineTests(BaseTest): self.module._setoption('error::Warning::0') self.assertRaises(UserWarning, self.module.warn, 'convert to error') + +class CWCmdLineTests(WCmdLineTests, unittest.TestCase): + module = c_warnings + + +class PyWCmdLineTests(WCmdLineTests, unittest.TestCase): + module = py_warnings + def test_improper_option(self): # Same as above, but check that the message is printed out when # the interpreter is executed. This also checks that options are @@ -550,12 +558,6 @@ class WCmdLineTests(BaseTest): self.assertFalse(out.strip()) self.assertNotIn(b'RuntimeWarning', err) -class CWCmdLineTests(WCmdLineTests, unittest.TestCase): - module = c_warnings - -class PyWCmdLineTests(WCmdLineTests, unittest.TestCase): - module = py_warnings - class _WarningsTests(BaseTest, unittest.TestCase): @@ -931,6 +933,7 @@ class BootstrapTest(unittest.TestCase): # Use -W to load warnings module at startup assert_python_ok('-c', 'pass', '-W', 'always', PYTHONPATH=cwd) + class FinalizationTest(unittest.TestCase): def test_finalization(self): # Issue #19421: warnings.warn() should not crash |