[Python-3000-checkins] r58877 - in python/branches/py3k-pep3137: Lib/test/test_inspect.py
christian.heimes
python-3000-checkins at python.org
Tue Nov 6 12:54:47 CET 2007
Author: christian.heimes
Date: Tue Nov 6 12:54:47 2007
New Revision: 58877
Modified:
python/branches/py3k-pep3137/ (props changed)
python/branches/py3k-pep3137/Lib/test/test_inspect.py
Log:
Merged revisions 58866-58876 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r58875 | christian.heimes | 2007-11-06 12:44:48 +0100 (Tue, 06 Nov 2007) | 2 lines
Fixed bug #1384 Windows fix for inspect tests
Thanks to Amaury Forgeot d'Arc for fixing my patch ;-)
........
Modified: python/branches/py3k-pep3137/Lib/test/test_inspect.py
==============================================================================
--- python/branches/py3k-pep3137/Lib/test/test_inspect.py (original)
+++ python/branches/py3k-pep3137/Lib/test/test_inspect.py Tue Nov 6 12:54:47 2007
@@ -4,6 +4,7 @@
import inspect
import datetime
import collections
+from os.path import normcase
from test.test_support import TESTFN, run_unittest
@@ -21,6 +22,13 @@
if modfile.endswith(('c', 'o')):
modfile = modfile[:-1]
+# Normalize file names: on Windows, the case of file names of compiled
+# modules depends on the path used to start the python executable.
+modfile = normcase(modfile)
+
+def revise(filename, *args):
+ return (normcase(filename),) + args
+
import __builtin__
try:
@@ -88,23 +96,23 @@
def test_stack(self):
self.assert_(len(mod.st) >= 5)
- self.assertEqual(mod.st[0][1:],
+ self.assertEqual(revise(*mod.st[0][1:]),
(modfile, 16, 'eggs', [' st = inspect.stack()\n'], 0))
- self.assertEqual(mod.st[1][1:],
+ self.assertEqual(revise(*mod.st[1][1:]),
(modfile, 9, 'spam', [' eggs(b + d, c + f)\n'], 0))
- self.assertEqual(mod.st[2][1:],
+ self.assertEqual(revise(*mod.st[2][1:]),
(modfile, 43, 'argue', [' spam(a, b, c)\n'], 0))
- self.assertEqual(mod.st[3][1:],
+ self.assertEqual(revise(*mod.st[3][1:]),
(modfile, 39, 'abuse', [' self.argue(a, b, c)\n'], 0))
def test_trace(self):
self.assertEqual(len(git.tr), 3)
- self.assertEqual(git.tr[0][1:], (modfile, 43, 'argue',
- [' spam(a, b, c)\n'], 0))
- self.assertEqual(git.tr[1][1:], (modfile, 9, 'spam',
- [' eggs(b + d, c + f)\n'], 0))
- self.assertEqual(git.tr[2][1:], (modfile, 18, 'eggs',
- [' q = y / 0\n'], 0))
+ self.assertEqual(revise(*git.tr[0][1:]),
+ (modfile, 43, 'argue', [' spam(a, b, c)\n'], 0))
+ self.assertEqual(revise(*git.tr[1][1:]),
+ (modfile, 9, 'spam', [' eggs(b + d, c + f)\n'], 0))
+ self.assertEqual(revise(*git.tr[2][1:]),
+ (modfile, 18, 'eggs', [' q = y / 0\n'], 0))
def test_frame(self):
args, varargs, varkw, locals = inspect.getargvalues(mod.fr)
@@ -198,8 +206,8 @@
self.assertSourceEqual(mod.StupidGit, 21, 46)
def test_getsourcefile(self):
- self.assertEqual(inspect.getsourcefile(mod.spam), modfile)
- self.assertEqual(inspect.getsourcefile(git.abuse), modfile)
+ self.assertEqual(normcase(inspect.getsourcefile(mod.spam)), modfile)
+ self.assertEqual(normcase(inspect.getsourcefile(git.abuse)), modfile)
def test_getfile(self):
self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
More information about the Python-3000-checkins
mailing list