Puzzled by py.test output

Jan Decaluwe jan at jandecaluwe.com
Wed Jan 18 08:51:07 EST 2006


I'm seeing a strange difference between error reporting
on local versus global variables, when using py.test.
Upon error, the actual value of a local is reported, but
not of a global. Does anyone know why? I'm using
the latest development version of py.test (from subversion).

Example code in file test.py:

--
def test_h():
     h = 0
     assert h == 1

g = 0
def test_g():
     assert g == 1
--

py.test output:

============================= test process starts ========
testing-mode: inprocess
executable:   /usr/local/bin/python  (2.4.2-final-0)
using py lib: /usr/local/lib/python2.4/site-packages/py <rev unknown>

test.py[2] FF

______________________________________________________
_____________________________ entrypoint: test_h ______

     def test_h():
         h = 0
E       assert h == 1
 >       assert 0 == 1

[/home/jand/project/myhdl/example/cookbook/stopwatch/test.py:3]
____________________________________________________
_____________________________ entrypoint: test_g __
     def test_g():
E       assert g == 1
 >       assert g == 1

[/home/jand/project/myhdl/example/cookbook/stopwatch/test.py:7]
_____________________________________________________________
================== tests finished: 2 failed in 0.02 seconds ==

Regards,

Jan

-- 
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
Losbergenlaan 16, B-3010 Leuven, Belgium
     From Python to silicon:
     http://myhdl.jandecaluwe.com



More information about the Python-list mailing list