]> granicus.if.org Git - python/commitdiff
This test failed on WindowsME because the full file path did not get
authorRaymond Hettinger <python@rcn.com>
Sun, 13 Jul 2003 06:15:11 +0000 (06:15 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 13 Jul 2003 06:15:11 +0000 (06:15 +0000)
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
Lib/test/test_warnings.py

index 9b45e422739a15e58a359ed9be46ca8e4aa1d850..8fe6d476f7e7cdc2e62f9bf2327972190045a567 100644 (file)
@@ -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'
index 9e375e02e80494936366f66a55ce66cf3ac3f0bc..5e8574b0b4d35eb7c2ec7ca5d407e6a0a47af758 100644 (file)
@@ -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():