{"id":7616,"library":"pytest-md-report","title":"pytest-md-report","description":"pytest-md-report is a pytest plugin designed to generate test outcomes reports formatted as markdown tables. It extends pytest's functionality by providing various command-line options and a programmatic interface to produce detailed, customizable reports. The library is actively maintained, with frequent updates to support new Python and pytest versions, currently at version 0.7.0.","status":"active","version":"0.7.0","language":"en","source_language":"en","source_url":"https://github.com/thombashi/pytest-md-report","tags":["pytest","testing","reporting","markdown","plugin","test-automation"],"install":[{"cmd":"pip install pytest-md-report","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core testing framework that this plugin extends.","package":"pytest","optional":false},{"reason":"Used internally for generating markdown tables. Minimum version bumps have occurred across releases.","package":"pytablewriter","optional":false},{"reason":"Requires Python 3.9 or newer.","package":"Python","optional":false}],"imports":[{"note":"pytest-md-report is primarily a pytest plugin used via command-line flags. There is no direct Python import for its core reporting functionality when running tests.","symbol":"pytest-md-report command-line plugin","correct":"pytest --md-report --md-report-output=report.md"},{"note":"The programmatic function `make_md_report` is located within the `converter` submodule, not directly under the top-level package.","wrong":"from pytest_md_report import make_md_report","symbol":"make_md_report","correct":"from pytest_md_report.converter import make_md_report"}],"quickstart":{"code":"import pytest\nimport os\n\ndef test_example_success():\n    assert True\n\ndef test_example_failure():\n    assert False\n\ndef test_example_skipped():\n    pytest.skip(\"demonstrating skip\")\n\n# Create a dummy test file\nwith open(\"test_example.py\", \"w\") as f:\n    f.write(\"\"\"\nimport pytest\n\ndef test_pass():\n    assert 1 + 1 == 2\n\ndef test_fail():\n    assert 1 + 1 == 3\n\n@pytest.mark.skip(reason='demonstrating skip')\ndef test_skip():\n    assert True\n    \"\"\"\n)\n\n# Run pytest with md-report options\n# This will generate 'report.md' in the current directory\n# and also output to stdout due to --md-report-tee\n\n# Using os.system for demonstration; in a real script, prefer pytest.main()\n# For security, avoid os.system with untrusted input.\nprint(\"\\n--- Running tests and generating report ---\")\nos.system(\"pytest --md-report --md-report-output=report.md --md-report-tee test_example.py\")\n\nprint(\"\\n--- Report generated: report.md ---\")\nprint(open(\"report.md\").read())\n\n# Clean up\nos.remove(\"test_example.py\")\nos.remove(\"report.md\")","lang":"python","description":"This quickstart demonstrates how to use pytest-md-report via the command line to generate a Markdown report. It creates a dummy test file, runs pytest with the `--md-report` flag to enable reporting, `--md-report-output` to specify an output file, and `--md-report-tee` to show the report on the console as well. The generated Markdown report will be saved as `report.md`."},"warnings":[{"fix":"Upgrade Python to 3.9 or newer, or downgrade `pytest-md-report` to `<0.6.3`.","message":"Support for Python 3.7 and 3.8 was dropped in version 0.6.3. Users on these Python versions must either upgrade Python or pin pytest-md-report to a version prior to 0.6.3.","severity":"breaking","affected_versions":">=0.6.3"},{"fix":"Ensure your `pytest` installation is less than version 9 (e.g., `pytest<9`). Check the `pytest-md-report` changelog for updates on pytest 9+ support.","message":"The maximum supported `pytest` version was bumped to `<9` in version 0.5.1. Users with `pytest` version 9.0.0 or higher may experience compatibility issues or unexpected behavior.","severity":"breaking","affected_versions":">=0.5.1"},{"fix":"Upgrade to `pytest-md-report>=0.6.2` to ensure stable results with GFM on Windows, or avoid the `gfm` flavor on Windows.","message":"When using the `--md-report-flavor=gfm` option on Windows, backslashes in paths (`\\`) could be misinterpreted by GitHub Flavored Markdown in versions prior to 0.6.2, leading to incorrectly rendered reports.","severity":"gotcha","affected_versions":"<0.6.2"},{"fix":"Remove the `exclude_outcomes` parameter when calling `make_md_report` if its default behavior is desired. If specific outcomes need to be excluded, use the new `md_report_exclude_outcomes` option or equivalent.","message":"The `make_md_report` programmatic method no longer requires the `exclude_outcomes` parameter when called, starting from version 0.6.1. While still accepted, passing this argument might be considered redundant in future versions.","severity":"deprecated","affected_versions":">=0.6.1"},{"fix":"Upgrade to `pytest-md-report>=0.7.0` and use the `--md-report-verbose=2` option to show test parameters.","message":"To display test parameters in the report, the verbosity level must be set to `2` using `--md-report-verbose=2`. Previous versions (before 0.7.0) did not support this granular level of detail for parameters.","severity":"gotcha","affected_versions":"<0.7.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run pytest with `pytest --md-report` (for console output by default), or `pytest --md-report --md-report-output=report.md` (to save to a file), or `pytest --md-report --md-report-tee --md-report-output=report.md` (for both).","cause":"The `--md-report` option was not used during the pytest execution, or `--md-report-output` was not specified for file output, and `--md-report-tee` was not used for console output.","error":"No markdown report file generated or no output on console."},{"fix":"Upgrade to `pytest-md-report>=0.7.0` and execute pytest with the `--md-report-verbose=2` option: `pytest --md-report --md-report-verbose=2`.","cause":"The `--md-report-verbose` option is not set to level 2, or the library version is older than 0.7.0 which introduced this feature.","error":"Test parameters are not visible in the generated Markdown report."},{"fix":"Change the import statement to `from pytest_md_report.converter import make_md_report`.","cause":"Incorrect import path for `make_md_report`. It's located in `pytest_md_report.converter`, not directly under `pytest_md_report`.","error":"Traceback: AttributeError: module 'pytest_md_report.converter' has no attribute 'make_md_report' (or similar)"},{"fix":"Upgrade to `pytest-md-report>=0.6.2` to resolve the Windows path rendering issue with GFM.","cause":"This is a known bug in versions prior to 0.6.2 where backslashes in Windows paths were not correctly handled for GFM.","error":"Report on Windows with `--md-report-flavor=gfm` shows malformed paths or incorrect rendering."}]}