test fix, .py vs .pyc

--HG--
branch : trunk
This commit is contained in:
Samuele Pedroni 2009-05-12 13:21:51 +02:00
parent 1e5ece07e8
commit 89c025335f
1 changed files with 6 additions and 2 deletions

View File

@ -364,7 +364,11 @@ def test_getfslineno():
fspath, lineno = getfslineno(f)
assert fspath == py.path.local(__file__)
fname = __file__
if fname.lower().endswith('.pyc'):
fname = fname[:-1]
assert fspath == py.path.local(fname)
assert lineno == f.func_code.co_firstlineno-1 # see findsource
class A(object):
@ -373,5 +377,5 @@ def test_getfslineno():
fspath, lineno = getfslineno(A)
_, A_lineno = py.std.inspect.findsource(A)
assert fspath == py.path.local(__file__)
assert fspath == py.path.local(fname)
assert lineno == A_lineno