From b09d3724a0dcf42fa49a47f001ffe20e39ea6d8c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 23 Sep 2015 19:15:44 -0300 Subject: [PATCH 1/4] Add docs on how to disable cache provider --- doc/en/cache.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/en/cache.rst b/doc/en/cache.rst index 1682e7c43..bf923cc6f 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -10,6 +10,16 @@ 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. + If for any reason you want to disable this plugin, you can do so by + adding ``-p no:cacheprovider`` to the command-line, or more permanently + to your ``pytest.ini`` file: + + .. code-block:: ini + + [pytest] + addopts = -p no:cacheprovider + + Usage --------- From 6caa7083db16907960067de8565f27ce455c43d0 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 28 Sep 2015 18:23:08 -0300 Subject: [PATCH 2/4] Moved more detailed options on how to disable a plugin to plugins.rst --- doc/en/cache.rst | 15 ++++++--------- doc/en/plugins.rst | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/doc/en/cache.rst b/doc/en/cache.rst index bf923cc6f..027376219 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -10,15 +10,6 @@ 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. - If for any reason you want to disable this plugin, you can do so by - adding ``-p no:cacheprovider`` to the command-line, or more permanently - to your ``pytest.ini`` file: - - .. code-block:: ini - - [pytest] - addopts = -p no:cacheprovider - Usage --------- @@ -36,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 ----------------------------------------------- diff --git a/doc/en/plugins.rst b/doc/en/plugins.rst index 48160dafa..51271c077 100644 --- a/doc/en/plugins.rst +++ b/doc/en/plugins.rst @@ -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`: @@ -123,6 +136,7 @@ in the `pytest repository `_. .. autosummary:: _pytest.assertion + _pytest.cacheprovider _pytest.capture _pytest.config _pytest.doctest From 5f860181b60bcdef6cf54713d0c0c89caa5e11d4 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 28 Sep 2015 18:25:20 -0300 Subject: [PATCH 3/4] Remove print left by accident --- _pytest/helpconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pytest/helpconfig.py b/_pytest/helpconfig.py index 5ede8b371..b445dcfc3 100644 --- a/_pytest/helpconfig.py +++ b/_pytest/helpconfig.py @@ -86,7 +86,7 @@ def showhelp(config): 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 From b184f391c6bc88ec1cedbf7d32ddc9f589cc7783 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 28 Sep 2015 18:34:16 -0300 Subject: [PATCH 4/4] Show known environment variables in py.test --help --- _pytest/helpconfig.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/_pytest/helpconfig.py b/_pytest/helpconfig.py index b445dcfc3..1df0c56ac 100644 --- a/_pytest/helpconfig.py +++ b/_pytest/helpconfig.py @@ -80,8 +80,18 @@ 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 "