[py-dev] bug in py.test
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
Hi! Ondrej Certik wrote: [snip]
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?
Not really, since the "new" module is really part of the standard library (which makes e.g. renaming it a bit hard :-) http://docs.python.org/lib/module-new.html Any library that uses this standard library module would break if you named your module new. Thanks for being interested in py.test! Cheers, Carl Friedrich
participants (2)
-
Carl Friedrich Bolz -
Ondrej Certik