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