Metadata-Version: 2.1
Name: pytest-csv
Version: 2.0.2
Summary: CSV output for pytest.
Home-page: https://github.com/nicoulaj/pytest-csv
Author: Julien Nicoulaud
Author-email: julien.nicoulaud@gmail.com
License: GPLv3
Keywords: py.test pytest csv tsv report
Platform: UNKNOWN
Classifier: Framework :: Pytest
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Requires-Dist: pytest (>=4.4)
Requires-Dist: six (>=1.0.0)
Provides-Extra: test
Requires-Dist: pytest-xdist (>=1.28.0) ; extra == 'test'
Requires-Dist: tabulate (>=0.8.2) ; extra == 'test'

pytest-csv
==========

.. image:: https://img.shields.io/pypi/v/pytest-csv.svg
   :target: https://pypi.org/project/pytest-csv
   :alt: last release

.. image:: https://img.shields.io/pypi/pyversions/pytest-csv.svg
   :target: https://pypi.org/project/pytest-csv
   :alt: pypi package

.. image:: https://img.shields.io/badge/pytest-4.4%2B-green.svg
   :target: https://pytest.org
   :alt: pytest supported versions

.. image:: https://travis-ci.org/nicoulaj/pytest-csv.svg?branch=master
   :target: https://travis-ci.org/nicoulaj/pytest-csv
   :alt: 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 <https://github.com/nicoulaj/pytest-csv/blob/master/pytest_csv/_hooks.py#L20>`_):

  ::

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

Issues
------

Please report issues `here <https://github.com/nicoulaj/pytest-csv/issues>`_.

License
-------

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


