test-env

Adds a table with information about the used test environment. This can be operating system, used python version, installed package and much more.

This information needs to be provided via json-file. Currently sphinx-test-reports supports the output of tox-env-report only.

tox based workflow

  1. Use tox for running your tests on different environments.
  2. Install tox-env-report.
  3. Run your tests with tox
  4. Locate generated file tox-envreport.json in your .tox folder
  5. Use this file like .. test-env:: ../.tox/tox-envreport.json

Options

data

Use :data: to define which data shall be printed out.

:data: must contain a comma separated list and the requested data is the element key, which got stored in the related dictionary of the requested environment.

Sub-keys like python.version are currently not supported.

Example

.. test-env:: ../.tox/tox-envreport.json
   :data: hostname, python, toxversion

Example of supported parameters (if using tox-env-report):

  • name
  • host
  • installed_packages
  • path
  • platform
  • reportversion
  • setup
  • test
  • toxversion

env

Prints out only the data of the given environment. :env: must be a comma separated list of environment names.

The give name should exist in the given json-file.

Example

.. test-env:: ../.tox/tox-envreport.json
   :env: py27, py35, flake8

raw

:raw: is a flag and if it is set, the output is a text interpretation of the json data.

Other options like :data: and :env: can still be used to filter the output.

Example

.. test-env:: ../.tox/tox-envreport.json
   :raw:

Examples

Default output

.. test-env: my/path/to/tox-envreport-short.json
   :env: py27
   :data: name, host, installed_packages

py27

Variable Data
name py35
host user_abc
installed_packages
[
    "arrow==0.10.0", 
    "atomicwrites==1.2.1"
]

Raw output

.. test-env: my/path/to/tox-envreport-short.json
   :raw:
   :env: py27
   :data: name, host, installed_packages

py27

{
    "name": "py35", 
    "host": "user_abc", 
    "installed_packages": [
        "arrow==0.10.0", 
        "atomicwrites==1.2.1"
    ]
}