thombashi / pytest-md-report

A pytest plugin to generate test outcomes reports with markdown table format.
MIT License
37 stars 5 forks source link

Allow using latex to colorize the markdown report #4

Closed dhirschfeld closed 1 year ago

dhirschfeld commented 1 year ago
filepath passed failed error skipped xfailed xpassed SUBTOTAL
$${\color[RGB]{153,0,26}\tt{examples/test\_error.py}}$$ $${\color[RGB]{153,0,26}\tt{2}}$$ $${\color[RGB]{153,0,26}\tt{2}}$$
$${\color[RGB]{153,0,26}\tt{examples/test\_failed.py}}$$ $${\color[RGB]{153,0,26}\tt{2}}$$ $${\color[RGB]{153,0,26}\tt{2}}$$
$${\color[RGB]{30,179,0}\tt{examples/test\_pass.py}}$$ $${\color[RGB]{30,179,0}\tt{2}}$$ $${\color[RGB]{30,179,0}\tt{2}}$$
$${\color[RGB]{255,221,51}\tt{examples/test\_skipped.py}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$
$${\color[RGB]{255,221,51}\tt{examples/test\_xfailed.py}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$
$${\color[RGB]{255,221,51}\tt{examples/test\_xpassed.py}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$
$${\color[RGB]{153,0,26}\tt{TOTAL}}$$ $${\color[RGB]{30,179,0}\tt{2}}$$ $${\color[RGB]{153,0,26}\tt{2}}$$ $${\color[RGB]{153,0,26}\tt{2}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$ $${\color[RGB]{255,221,51}\tt{2}}$$ $${\color[RGB]{153,0,26}\tt{12}}$$
thombashi commented 1 year ago

@dhirschfeld Thank you for your suggestion. pytest-md-report 0.5.0 added --md-report-flavor option. With this option (--md-report-flavor gfm), you can render colorized markdown using latex. Like the following:

filepath $$\textcolor{#23d18b}{\tt{passed}}$$ $$\textcolor{#f14c4c}{\tt{failed}}$$ $$\textcolor{#f14c4c}{\tt{error}}$$ $$\textcolor{#f5f543}{\tt{skipped}}$$ $$\textcolor{#f5f543}{\tt{xfailed}}$$ $$\textcolor{#f5f543}{\tt{xpassed}}$$ SUBTOTAL
$$\textcolor{#f14c4c}{\tt{test\_error.py}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$
$$\textcolor{#f14c4c}{\tt{test\_failed.py}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$
$$\textcolor{#23d18b}{\tt{test\_pass.py}}$$ $$\textcolor{#23d18b}{\tt{2}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#23d18b}{\tt{2}}$$
$$\textcolor{#f5f543}{\tt{test\_skipped.py}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f5f543}{\tt{2}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f5f543}{\tt{2}}$$
$$\textcolor{#f5f543}{\tt{test\_xfailed.py}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f5f543}{\tt{2}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f5f543}{\tt{2}}$$
$$\textcolor{#f5f543}{\tt{test\_xpassed.py}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#666666}{\tt{0}}$$ $$\textcolor{#f5f543}{\tt{2}}$$ $$\textcolor{#f5f543}{\tt{2}}$$
$$\textcolor{#f14c4c}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{2}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$ $$\textcolor{#f14c4c}{\tt{2}}$$ $$\textcolor{#f5f543}{\tt{2}}$$ $$\textcolor{#f5f543}{\tt{2}}$$ $$\textcolor{#f5f543}{\tt{2}}$$ $$\textcolor{#f14c4c}{\tt{12}}$$
dhirschfeld commented 1 year ago

@thombashi - thanks for the very useful project, and thanks for implementing the suggestion! :heart: