Error in PyCode_CheckLineNumber() using py.test 'magic'+figleaf plugin with Leopard's Python 2.5

Create issue
Issue #28 wontfix
Former user created an issue

Hi,

I found the following error message:

{{{ #!text

$ py.test -s : python: platform darwin -- Python 2.5.1 test object 1: /Users/osantana/pytest_bug : test_bug.py Assertion failed: (line > 0), function PyCode_CheckLineNumber, file Objects/codeobject.c, line 546. Abort trap }}}

When I disable the "magic" (or figleaf plugin) it works ok:

{{{ #!text $ py.test -s --nomagic # (or disable figleaf plugin) : python: platform darwin -- Python 2.5.1 test object 1: /Users/osantana/pytest_bug

test_bug.py F

def test_bug():
  assert "a" == "b"

E AssertionError

/Users/osantana/pytest_bug/test_bug.py:2: AssertionError

figleaf : }}}

I'm using py.test version 1.0.0b8.

I tried to track the bug and I discovered that the "Assertion failed" in:

{{{

.../py/code/frame.py(32)eval() -> return eval(code, self.f_globals, f_locals) (Pdb) n Assertion failed: (line > 0), function PyCode_CheckLineNumber, file Objects/codeobject.c, line 546. Abort trap }}}

The test is very simple:

{{{ #!python def test_bug(): assert "a" == "b" }}}

Comments (8)

  1. Holger Krekel repo owner
    • changed status to open

    maybe there are two issues here. the one is some figleaf/python interaction - does that also happen with 2.6?

    the other is that py.test apparently not deals properly with Assertion Errors raised from C code. i'll check into that.

  2. Osvaldo Santana

    It works correctly with Python 2.6.2 but not with Python 2.5.1 (Mac Leopard's default):

    $ py.test
    :
    python: platform darwin -- Python 2.6.2
    test object 1: .../pytest_bug
    
    test_bug.py F
    
    :
    
        def test_bug():
    >       assert "a" == "b"
    E       assert 'a' == 'b'
    
    .../pytest_bug/test_bug.py:2: AssertionError
    
    ---- figleaf ----
    
    Writing figleaf data to .../pytest_bug/.figleaf
    Writing figleaf html to file://.../pytest_bug/html
    CANNOT OPEN: <eval>
    CANNOT OPEN: ?
    
  3. Holger Krekel repo owner

    sorry for taking a while - didn't get an e-mail for this issue. Can you update to 1.0. and do a "py.test --verbose --pastebin=all" and send the URL? I am suspecting it's not related to py.test but to a figleaf compatibility issue (figleaf is a separate project by Titus Brown).

  4. Holger Krekel repo owner

    is the figleaf issue still present for you? Can you install py-1.1.1 and run "py.test --verbose --pastebin=all" and post the URL here if so?

    tentatively closing this issue.

  5. Former user Account Deleted

    I don't have the Leopard native Python 2.5 to test (I've upgraded to Snow Leopard with Python 2.6.1). But it's working correctly now (Snow Leopard, Python 2.6.1, py-1.1.1).

  6. Log in to comment