一个pytest插件,用Markdown表格式生成测试结果报告。

pytest-md-report的Python项目详细描述


Summary

PyPI package versionSupported Python versionsSupported Python implementationsLinux/macOS CI statusWindows CI status

一个pytest插件,用Markdown表格式生成测试结果报告。在

Installation

pip install pytest-md-report

Usage

^{pr2}$
https://github.com/thombashi/pytest-md-report/blob/master/ss/pytest_md_report_example.png

输出示例

Other examples

增加详细级别(--md-report-verbose选项):

$ pytest --md-report --md-report-verbose=1 examples/
https://github.com/thombashi/pytest-md-report/blob/master/ss/pytest_md_report_example_verbose.png

输出示例(详细)

不呈现零值(--md-report-zeros emmpty选项)的结果:

$ pytest --md-report --md-report-zeros empty --md-report-color never examples/
|         filepath         | passed | failed | error | skipped | xfailed | xpassed | SUBTOTAL |
|--------------------------|-------:|-------:|------:|--------:|--------:|--------:|---------:|
| examples/test_error.py   |        |        |     2 |         |         |         |        2 |
| examples/test_failed.py  |        |      2 |       |         |         |         |        2 |
| examples/test_pass.py    |      2 |        |       |         |         |         |        2 |
| examples/test_skipped.py |        |        |       |       2 |         |         |        2 |
| examples/test_xfailed.py |        |        |       |         |       2 |         |        2 |
| examples/test_xpassed.py |        |        |       |         |         |       2 |        2 |
| TOTAL                    |      2 |      2 |     2 |       2 |       2 |       2 |       12 |

Options

Command options

make test results report with markdown table format:
  --md-report           create markdown report. you can also specify the value
                        with PYTEST_MD_REPORT environment variable.
  --md-report-verbose=VERBOSITY_LEVEL
                        verbosity level for pytest-md-report. if not set, using
                        verbosity level of pytest. defaults to 0. you can also
                        specify the value with PYTEST_MD_REPORT_VERBOSE
                        environment variable.
  --md-report-color={auto,text,never}
                        auto: display colored (text and background) reports by
                        using ANSI escape codes. text: display colored (text)
                        reports by using ANSI escape codes. never: display
                        report without color. defaults to 'auto'. you can also
                        specify the value with PYTEST_MD_REPORT_COLOR
                        environment variable.
  --md-report-margin=MARGIN
                        margin size for each cells. defaults to 1. you can also
                        specify the value with PYTEST_MD_REPORT_MARGIN
                        environment variable.
  --md-report-zeros={number,empty}
                        rendering method for results of zero values. number:
                        render as a digit number (0). empty: not rendering.
                        defaults to number. you can also specify the value with
                        PYTEST_MD_REPORT_ZEROS environment variable.
  --md-report-success-color=MD_REPORT_SUCCESS_COLOR
                        text color of succeeded results. specify a color name
                        (one of the black/red/green/yellow/blue/magenta/cyan/whi
                        te/lightblack/lightred/lightgreen/lightyellow/lightblue/
                        lightmagenta/lightcyan/lightwhite) or a coor code (e.g.
                        #ff1020). defaults to light_green. you can also specify
                        the value with PYTEST_MD_REPORT_SUCCESS_COLOR
                        environment variable.
  --md-report-skip-color=MD_REPORT_SKIP_COLOR
                        text color of skipped results. specify a color name (one
                        of the black/red/green/yellow/blue/magenta/cyan/white/li
                        ghtblack/lightred/lightgreen/lightyellow/lightblue/light
                        magenta/lightcyan/lightwhite) or a coor code (e.g.
                        #ff1020). defaults to light_yellow. you can also specify
                        the value with PYTEST_MD_REPORT_SKIP_COLOR environment
                        variable.
  --md-report-error-color=MD_REPORT_ERROR_COLOR
                        text color of failed results. specify a color name (one
                        of the black/red/green/yellow/blue/magenta/cyan/white/li
                        ghtblack/lightred/lightgreen/lightyellow/lightblue/light
                        magenta/lightcyan/lightwhite) or a coor code (e.g.
                        #ff1020). defaults to light_red. you can also specify
                        the value with PYTEST_MD_REPORT_ERROR_COLOR environment
                        variable.

ini-options

找到第一个pytest.ini/tox.ini/setup.cfg/pyproject.toml (pytest 6.0.0 or later)文件中的[pytest]ini选项:

md_report (bool):     create markdown report.
md_report_verbose (string):
                      verbosity level for pytest-md-report. if not set, using
                      verbosity level of pytest. defaults to 0.
md_report_color (string):
                      auto: display colored (text and background) reports by
                      using ANSI escape codes. text: display colored (text)
                      reports by using ANSI escape codes. never: display
                      report without color. defaults to 'auto'.
md_report_margin (string):
                      margin size for each cells. defaults to 1.
md_report_zeros (string):
                      rendering method for results of zero values. number:
                      render as a digit number (0). empty: not rendering.
                      defaults to number.
md_report_success_color (string):
                      text color of succeeded results. specify a color name
                      (one of the black/red/green/yellow/blue/magenta/cyan/whi
                      te/lightblack/lightred/lightgreen/lightyellow/lightblue/
                      lightmagenta/lightcyan/lightwhite) or a coor code (e.g.
                      #ff1020). defaults to light_green.
md_report_skip_color (string):
                      text color of skipped results. specify a color name (one
                      of the black/red/green/yellow/blue/magenta/cyan/white/li
                      ghtblack/lightred/lightgreen/lightyellow/lightblue/light
                      magenta/lightcyan/lightwhite) or a coor code (e.g.
                      #ff1020). defaults to light_yellow.
md_report_error_color (string):
                      text color of failed results. specify a color name (one
                      of the black/red/green/yellow/blue/magenta/cyan/white/li
                      ghtblack/lightred/lightgreen/lightyellow/lightblue/light
                      magenta/lightcyan/lightwhite) or a coor code (e.g.
                      #ff1020). defaults to light_red.
Example of ^{tt7}$:
^{pr 8}$
Example of ^{tt5}$:
^{pr 9}$

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在href中将struts2文本字段的值作为参数传递?   java检查对象属性是否为空的最佳方法是什么?   java通过Maven使用Junit类别运行Cucumber测试   java如何在selenium Webdriver(Mac)中使用Robot类上传多个文件?   如何用python绘制图形或将python转换为java和Matlab?   java Osgi捆绑包更新和ResourceBundle   java使用流api将流<@Nullable T>转换为流<@NonNull T>   java中EXCEL的平台无关连接字符串   JavaFX中的java表   java Jetty线程池和sun。HttpServer会话   JPA存储库bean的java Spring注入无法工作NullPointerException   java从另一个Kubernetes作业触发Kubernetes   我的java netbeans抽奖计划需要帮助吗   泛型中的java有界类型无法扩展另一个有界类型   如果混合使用全局构建和概要文件构建,java cxfcodegenplugin会生成错误代码   封装SQL平台之间差异的java策略?