[pytest-dev] Python syntax highlighting when displaying failing code?

Floris Bruynooghe flub at devork.be
Mon Oct 27 10:00:17 CET 2014


Hi Dinu,

On 26 October 2014 19:48, Dinu Gherman <gherman at darwin.in-berlin.de> wrote:
> 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.?

I think this could be a very nice feature.  It might be worth trying
to make this as a plugin, at least initially, because it will
introduce a new dependency (pygments I assume).  If some coordination
is required like a new hook or a way to detect which part is source
code, I'm sure patches like that would be possible to merge into the
core right away.

> 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.

There's probably a few options here to try out, one as you suggest or
try just having the 'E' in red or maybe even something else.  Only
trying it will show which works better I guess.

> 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.

No worries, feel free to ask questions here or on IRC.

Regards,
Floris

-- 
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org


More information about the pytest-dev mailing list