Skip to main content

pytest-csv

last release pypi package pytest supported versions continuous integration

CSV output for pytest.


Installation

Install using pip:

pip install pytest-csv

Usage

  • To enable the CSV report:

    py.test --csv tests.csv
  • To customize the CSV delimiter/quoting characters:

    py.test --csv tests.csv --csv-delimiter ';' --csv-quote-char '"'
  • To customize the columns:

    py.test --csv tests.csv --csv-columns host,function,status,duration,parameters_as_columns
  • This is the reference of all available columns:

    Column

    Description

    id

    pytest test identifier

    module

    test module name

    class

    test class

    function

    test function name

    name

    test name, with arguments

    file

    test module file

    doc

    test function docstring

    status

    test status (passed, failed, error, skipped, xpassed or xfailed)

    success

    test status, as a boolean

    duration

    test duration, in seconds

    duration_formatted

    test duration, human readable

    message

    error message, if any

    markers

    test markers, as a comma-separated list

    markers_with_args

    test markers with their arguments, as a comma-separated list

    markers_as_columns

    test markers, each as a separate column

    markers_args_as_columns

    test markers with their arguments, each as a separate column

    parameters

    test parameters, as a comma-separated list

    parameters_as_columns

    test parameters, each as a separate column

    properties

    properties recorded using record_property, as a comma-separated list

    properties_as_columns

    properties recorded using record_property, each as a separate column

    user

    current user name

    host

    current host (from platform module)

    system

    current system name (from platform module)

    system_release

    current system release info (from platform module)

    system_version

    current system version info (from platform module)

    python_implementation

    current python implementation (from platform module)

    python_version

    current python version (from platform module)

    working_directory

    current working directory

  • To add some data directly from a test function, enable properties_as_columns and use:

    def test_01(record_property):
        record_property('my column 1', 42)
        record_property('my column 2', 'foo bar')
  • To define new column types, in conftest.py (more examples here):

    def pytest_csv_register_columns(columns):
        columns['my_simple_column'] = lambda item, report: {'my column': report.nodeid}

Issues

Please report issues here.

License

This software is released under the GNU General Public License v3.0, see COPYING for details.

Metadata

Release files for pytest-csv 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-csv 3.0.0
File Size Uploaded
pytest-csv-3.0.0.tar.gz 21.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-csv 3.0.0
File Interpreter ABI Platform
pytest_csv-3.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 48.3 kB

Release files / pytest-csv-3.0.0.tar.gz

Download URL pytest-csv-3.0.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6d01e7db1aa2137eae822d3fdb2d6a5dd0ce736548593b5311ae3cf41e2d12d4
BLAKE2b-256 checksum
How to use checksums
76a6dd9820c07c0d6251ab9c8764307aca3cd2ce9057f7f9459edd173dab342e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release files / pytest_csv-3.0.0-py2.py3-none-any.whl

Download URL pytest_csv-3.0.0-py2.py3-none-any.whl
Size 26.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
599ab855d2ba748275dc7f814f63f9f6593bdd9a064f27cfd3940e68e6525c36
BLAKE2b-256 checksum
How to use checksums
e62c2ce553f606e1544655928d7a9280c63270d57a431e3dad621132e09a8147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page