[Python-checkins] r54675 - python/trunk/Lib/test/test_warnings.py python/trunk/Lib/test/warning_tests.py (original) (raw)

walter.doerwald python-checkins at python.org
Tue Apr 3 18:53:49 CEST 2007


Author: walter.doerwald Date: Tue Apr 3 18:53:43 2007 New Revision: 54675

Added: python/trunk/Lib/test/warning_tests.py Modified: python/trunk/Lib/test/test_warnings.py Log: Add tests for the filename.

Test that the stacklevel is handled correctly.

Modified: python/trunk/Lib/test/test_warnings.py

--- python/trunk/Lib/test/test_warnings.py (original) +++ python/trunk/Lib/test/test_warnings.py Tue Apr 3 18:53:43 2007 @@ -3,6 +3,8 @@ import unittest from test import test_support

+import warning_tests +

The warnings module isn't easily tested, because it relies on module

globals to store configuration information. setUp() and tearDown()

preserve the current settings to avoid bashing them while running tests.

@@ -97,6 +99,28 @@ warnings._setoption('error::Warning::0') self.assertRaises(UserWarning, warnings.warn, 'convert to error')

def test_main(verbose=None): # Obscure hack so that this test passes after reloads or repeated calls

Added: python/trunk/Lib/test/warning_tests.py

--- (empty file) +++ python/trunk/Lib/test/warning_tests.py Tue Apr 3 18:53:43 2007 @@ -0,0 +1,9 @@ +# Helper module for testing the skipmodules argument of warnings.warn() + +import warnings + +def outer(message, stacklevel=1):



More information about the Python-checkins mailing list