pytest-csv

3.0.0 · active · verified Tue Apr 14

pytest-csv is a pytest plugin that generates test reports in CSV format. It allows users to customize the output columns and delimiters for detailed analysis of test results. The current version is 3.0.0, released in April 2021, and it maintains an infrequent release cadence.

Warnings

Install

Imports

Quickstart

Create a Python file with some pytest tests. Then, run pytest from the command line, specifying the `--csv` option followed by the desired output filename. The plugin will automatically generate a CSV report with test results.

import pytest
import os

def test_example_passed():
    assert True

def test_example_failed():
    assert False

def test_example_skipped():
    pytest.skip("Demonstrating skip")

# To run and generate a CSV report, save this as `test_report.py`
# then run from your terminal: `pytest --csv report.csv test_report.py`
# Optionally, customize columns: `pytest --csv report.csv --csv-columns id,status,duration`

view raw JSON →