Merge pull request #1058 from nicoddemus/doc-how-disable-cache

Add docs on how to disable cache provider
This commit is contained in:
Ronny Pfannschmidt 2015-10-01 13:06:02 +02:00
commit 688f955f5e
3 changed files with 36 additions and 5 deletions

View File

@ -80,13 +80,23 @@ def showhelp(config):
line = " %-24s %s" %(spec, help) line = " %-24s %s" %(spec, help)
tw.line(line[:tw.fullwidth]) tw.line(line[:tw.fullwidth])
tw.line() ; tw.line() tw.line()
#tw.sep("=") tw.line("environment variables:")
vars = [
("PYTEST_ADDOPTS", "extra command line options"),
("PYTEST_PLUGINS", "comma-separated plugins to load during startup"),
("PYTEST_DEBUG", "set to enable debug tracing of pytest's internals")
]
for name, help in vars:
tw.line(" %-24s %s" % (name, help))
tw.line()
tw.line()
tw.line("to see available markers type: py.test --markers") tw.line("to see available markers type: py.test --markers")
tw.line("to see available fixtures type: py.test --fixtures") tw.line("to see available fixtures type: py.test --fixtures")
tw.line("(shown according to specified file_or_dir or current dir " tw.line("(shown according to specified file_or_dir or current dir "
"if not specified)") "if not specified)")
tw.line(str(reporter.stats))
for warningreport in reporter.stats.get('warnings', []): for warningreport in reporter.stats.get('warnings', []):
tw.line("warning : " + warningreport.message, red=True) tw.line("warning : " + warningreport.message, red=True)
return return

View File

@ -10,6 +10,7 @@ Cache: working with cross-testrun state
is compatible regarding command line options and API usage except that you is compatible regarding command line options and API usage except that you
can only store/receive data between test runs that is json-serializable. can only store/receive data between test runs that is json-serializable.
Usage Usage
--------- ---------
@ -26,6 +27,12 @@ all cross-session cache contents ahead of a test run.
Other plugins may access the `config.cache`_ object to set/get Other plugins may access the `config.cache`_ object to set/get
**json encodable** values between ``py.test`` invocations. **json encodable** values between ``py.test`` invocations.
.. note::
This plugin is enabled by default, but can be disabled if needed: see
:ref:`cmdunregister` (the internal name for this plugin is
``cacheprovider``).
Rerunning only failures or failures first Rerunning only failures or failures first
----------------------------------------------- -----------------------------------------------

View File

@ -108,8 +108,21 @@ You can prevent plugins from loading or unregister them::
py.test -p no:NAME py.test -p no:NAME
This means that any subsequent try to activate/load the named This means that any subsequent try to activate/load the named
plugin will it already existing. See :ref:`findpluginname` for plugin will not work.
how to obtain the name of a plugin.
If you want to unconditionally disable a plugin for a project, you can add
this option to your ``pytest.ini`` file:
.. code-block:: ini
[pytest]
addopts = -p no:NAME
Alternatively to disable it only in certain environments (for example in a
CI server), you can set ``PYTEST_ADDOPTS`` environment variable to
``-p no:name``.
See :ref:`findpluginname` for how to obtain the name of a plugin.
.. _`builtin plugins`: .. _`builtin plugins`:
@ -123,6 +136,7 @@ in the `pytest repository <https://github.com/pytest-dev/pytest>`_.
.. autosummary:: .. autosummary::
_pytest.assertion _pytest.assertion
_pytest.cacheprovider
_pytest.capture _pytest.capture
_pytest.config _pytest.config
_pytest.doctest _pytest.doctest