('ignore', False, 'FutureWarning', False, 0)
('ignore', True, 'OverflowWarning', True, 0)
('ignore', True, 'PendingDeprecationWarning', True, 0)
-Lib/test/test_warnings.py:31: UserWarning: hello world
-Lib/test/test_warnings.py:32: UserWarning: hello world
-Lib/test/test_warnings.py:33: DeprecationWarning: hello world
-Lib/test/test_warnings.py:35: UserWarning: hello world
+test_warnings.py:31: UserWarning: hello world
+test_warnings.py:32: UserWarning: hello world
+test_warnings.py:33: DeprecationWarning: hello world
+test_warnings.py:35: UserWarning: hello world
Caught UserWarning: hello world
Caught AssertionError: invalid action: 'booh'
import warnings
+import os
# The warnings module isn't easily tested, because it relies on module
# globals to store configuration information. We need to extract the
_showwarning = None
def showwarning(message, category, filename, lineno, file=None):
- i = filename.find("Lib")
- filename = filename[i:]
+ filename = os.path.basename(filename)
print "%s:%s: %s: %s" % (filename, lineno, category.__name__, message)
def monkey():