58 lines
1.7 KiB
Plaintext
58 lines
1.7 KiB
Plaintext
basic test configuration
|
|
===================================
|
|
|
|
Command line options and configuration file settings
|
|
-----------------------------------------------------------------
|
|
|
|
You can get help on options and configuration options by running::
|
|
|
|
py.test -h # prints options _and_ config file settings
|
|
|
|
This will display command line and configuration file settings
|
|
which were registered by installed plugins.
|
|
|
|
how test configuration is read from setup/tox ini-files
|
|
--------------------------------------------------------
|
|
|
|
py.test looks for the first ``[pytest]`` section in either the first ``setup.cfg`` or the first ``tox.ini`` file found upwards from the arguments. Example::
|
|
|
|
py.test path/to/testdir
|
|
|
|
will look in the following dirs for a config file::
|
|
|
|
path/to/testdir/setup.cfg
|
|
path/to/setup.cfg
|
|
path/setup.cfg
|
|
setup.cfg
|
|
... # up until root of filesystem
|
|
path/to/testdir/tox.ini
|
|
path/to/tox.ini
|
|
path/tox.ini
|
|
... # up until root of filesystem
|
|
|
|
If no path was provided at all the current working directory is used for the lookup.
|
|
|
|
builtin configuration file options
|
|
----------------------------------------------
|
|
|
|
.. confval:: minversion = VERSTRING
|
|
|
|
specifies the minimal pytest version that is needed for this test suite.
|
|
|
|
minversion = 2.1 # will fail if we run with pytest-2.0
|
|
|
|
.. confval:: addopts = OPTS
|
|
|
|
add the specified ``OPTS`` to the set of command line arguments as if they
|
|
had been specified by the user. Example: if you have this ini file content::
|
|
|
|
[pytest]
|
|
addopts = --maxfail=2 -rf # exit after 2 failures, report fail info
|
|
|
|
issuing ``py.test test_hello.py`` actually means::
|
|
|
|
py.test --maxfail=2 -rf test_hello.py
|
|
|
|
.. _`function arguments`: funcargs.html
|
|
|