Skip to content

Add docs on how to disable cache provider #1058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions _pytest/helpconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,23 @@ def showhelp(config):
line = " %-24s %s" %(spec, help)
tw.line(line[:tw.fullwidth])

tw.line() ; tw.line()
#tw.sep("=")
tw.line()
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 fixtures type: py.test --fixtures")
tw.line("(shown according to specified file_or_dir or current dir "
"if not specified)")
tw.line(str(reporter.stats))

for warningreport in reporter.stats.get('warnings', []):
tw.line("warning : " + warningreport.message, red=True)
return
Expand Down
7 changes: 7 additions & 0 deletions doc/en/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cache: working with cross-testrun state
is compatible regarding command line options and API usage except that you
can only store/receive data between test runs that is json-serializable.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if it's the right thing to advise to do this on a per-project level. You might want cache behaviour on dev machines but not on CI systems. Therefore we should rather advise for setting the environment variable PYTEST_ADDOPTS for respective environments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addition we should see to add some info about environment variables with py.test --help i guess. (like "tox -h" does) (but than can be done in a separate future PR).

Usage
---------

Expand All @@ -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
**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
-----------------------------------------------
Expand Down
18 changes: 16 additions & 2 deletions doc/en/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,21 @@ You can prevent plugins from loading or unregister them::
py.test -p no:NAME

This means that any subsequent try to activate/load the named
plugin will it already existing. See :ref:`findpluginname` for
how to obtain the name of a plugin.
plugin will not work.

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`:

Expand All @@ -123,6 +136,7 @@ in the `pytest repository <https://github.com/pytest-dev/pytest>`_.
.. autosummary::

_pytest.assertion
_pytest.cacheprovider
_pytest.capture
_pytest.config
_pytest.doctest
Expand Down