Hi,

I just wondered how much people here would appreciate a new feature for py.test 
which would add Python syntax highlighting to failing code shown before asserts 
etc.? In the following example below that would mean the three lines I marked 
on the right side with '<'. If we had this the lines already displayed in red 
and with a leading 'E' might perhaps need to be displaying in reversed mode and 
still red to stand out more than before.

I've done something similar when using fabric for a while wrapped inside of my 
own package, so I could write "myfab --source mytask" and see the respective 
highlighted code that would be executed. To do that I used pygments which I 
think is not too heavy weight to include in py.test, but Holger's mileage may 
vary.

Just let me know what you think. If this is considered worth the effort, I 
might ask for some little hints pointing me to the code to touch, because in 
fact I'm not very familiar with the py.test code and lack the time now to make 
an in-depth code analysis.

Cheers,

Dinu 

PS:

$ py.test fib.py
============================= test session starts ==============================
platform darwin -- Python 2.7.6 -- py-1.4.26 -- pytest-2.6.4
plugins: timeout, pep8, xdist, cache, cov
collected 1 items 

fib.py F

=================================== FAILURES ===================================
_____________________________________ test _____________________________________

    def test():                             <
        "Test fib(10), should not be 10."   <
>       assert fib(10) == 10                <
E       assert 55 == 10
E        +  where 55 = fib(10)

fib.py:24: AssertionError
=========================== 1 failed in 0.04 seconds ===========================

_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to