[py-dev] bug in py.test

Ondrej Certik ondrej at certik.cz
Mon Mar 27 20:18:21 CEST 2006


Hello,
if I execute:

mkdir new
touch new/__init__.py
py.test ~/pytest/py-dist/py/documentation/example/pytest/failure_demo.py

I don't get a nice demo, but this:

....

    return py.std.new.code(
        kwargs['co_argcount'],
        kwargs['co_nlocals'],
        kwargs['co_stacksize'],
        kwargs['co_flags'],
        kwargs['co_code'],
        kwargs['co_consts'],
        kwargs['co_names'],
        kwargs['co_varnames'],
        kwargs['co_filename'],
        kwargs['co_name'],
        kwargs['co_firstlineno'],
        kwargs['co_lnotab'],
        kwargs['co_freevars'],
        kwargs['co_cellvars'],
E   )
>       AttributeError: 'module' object has no attribute 'code'

[/home/ondra/pytest/py-dist/py/code/code.py:38]
================== tests finished: 21 failed in 1.42 seconds ===================

The new module in the current directory is probably colliding with something in
py.test. If I rename new to new2, then everything is fine and I got this
result:

...

    def foo():
E    assert 1 == 0
>    assert 1 == 0

[/tmp/test/abc-123</home/ondra/pytest/py-dist/py/code/source.py:215>:2]
================== tests finished: 21 failed in 1.46 seconds ===================

One of my modules is called "new", so I have to rename it because if this.

Is it a bug?

Ondrej



More information about the Pytest-dev mailing list