From 89c025335f22df55ed893c0e4ba10927dfc22812 Mon Sep 17 00:00:00 2001 From: Samuele Pedroni Date: Tue, 12 May 2009 13:21:51 +0200 Subject: [PATCH] test fix, .py vs .pyc --HG-- branch : trunk --- py/code/testing/test_source.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/py/code/testing/test_source.py b/py/code/testing/test_source.py index 2ed6f1fc7..9d360b243 100644 --- a/py/code/testing/test_source.py +++ b/py/code/testing/test_source.py @@ -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