From dc9dcf135e7bde09726d0af5cd55f49c31851c66 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 13 Jul 2003 06:15:11 +0000 Subject: [PATCH] This test failed on WindowsME because the full file path did not get reported consistently with the *nix world. 'Lib/test/test_warnings.py' came out as 'lib\test\test_warnings.py'. The basename is all we care about so I used that. --- Lib/test/output/test_warnings | 8 ++++---- Lib/test/test_warnings.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/test/output/test_warnings b/Lib/test/output/test_warnings index 9b45e422739..8fe6d476f7e 100644 --- a/Lib/test/output/test_warnings +++ b/Lib/test/output/test_warnings @@ -2,9 +2,9 @@ test_warnings ('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' diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index 9e375e02e80..5e8574b0b4d 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -1,4 +1,5 @@ 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 @@ -8,8 +9,7 @@ _filters = [] _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():