Merge pull request #3401 from kohr-h/underscore_fixtures
Mention omission of fixtures with leading '_', closes #3398
This commit is contained in:
commit
159cd39777
|
@ -138,7 +138,8 @@ def showhelp(config):
|
||||||
tw.line("to see available markers type: pytest --markers")
|
tw.line("to see available markers type: pytest --markers")
|
||||||
tw.line("to see available fixtures type: pytest --fixtures")
|
tw.line("to see available fixtures type: pytest --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; fixtures with leading '_' are only shown "
|
||||||
|
"with the '-v' option")
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -75,7 +75,8 @@ def pytest_addoption(parser):
|
||||||
group = parser.getgroup("general")
|
group = parser.getgroup("general")
|
||||||
group.addoption('--fixtures', '--funcargs',
|
group.addoption('--fixtures', '--funcargs',
|
||||||
action="store_true", dest="showfixtures", default=False,
|
action="store_true", dest="showfixtures", default=False,
|
||||||
help="show available fixtures, sorted by plugin appearance")
|
help="show available fixtures, sorted by plugin appearance "
|
||||||
|
"(fixtures with leading '_' are only shown with '-v')")
|
||||||
group.addoption(
|
group.addoption(
|
||||||
'--fixtures-per-test',
|
'--fixtures-per-test',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Mention in documentation and CLI help that fixtures with leading ``_`` are printed by ``pytest --fixtures`` only if the ``-v`` option is added.
|
|
@ -12,7 +12,7 @@ For information on plugin hooks and objects, see :ref:`plugins`.
|
||||||
|
|
||||||
For information on the ``pytest.mark`` mechanism, see :ref:`mark`.
|
For information on the ``pytest.mark`` mechanism, see :ref:`mark`.
|
||||||
|
|
||||||
For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures, type::
|
For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures (add ``-v`` to also see fixtures with leading ``_``), type ::
|
||||||
|
|
||||||
$ pytest -q --fixtures
|
$ pytest -q --fixtures
|
||||||
cache
|
cache
|
||||||
|
|
|
@ -111,11 +111,11 @@ with a list of available function arguments.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
You can always issue::
|
You can always issue ::
|
||||||
|
|
||||||
pytest --fixtures test_simplefactory.py
|
pytest --fixtures test_simplefactory.py
|
||||||
|
|
||||||
to see available fixtures.
|
to see available fixtures (fixtures with leading ``_`` are only shown if you add the ``-v`` option).
|
||||||
|
|
||||||
Fixtures: a prime example of dependency injection
|
Fixtures: a prime example of dependency injection
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
|
@ -166,6 +166,8 @@ Find out what kind of builtin :ref:`pytest fixtures <fixtures>` exist with the c
|
||||||
|
|
||||||
pytest --fixtures # shows builtin and custom fixtures
|
pytest --fixtures # shows builtin and custom fixtures
|
||||||
|
|
||||||
|
Note that this command omits fixtures with leading ``_`` unless the ``-v`` option is added.
|
||||||
|
|
||||||
Continue reading
|
Continue reading
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ command line options
|
||||||
``--full-trace``
|
``--full-trace``
|
||||||
don't cut any tracebacks (default is to cut).
|
don't cut any tracebacks (default is to cut).
|
||||||
``--fixtures``
|
``--fixtures``
|
||||||
show available function arguments, sorted by plugin
|
show available fixtures, sorted by plugin appearance (fixtures with leading ``_`` are only shown with '-v')
|
||||||
|
|
||||||
Start improving this plugin in 30 seconds
|
Start improving this plugin in 30 seconds
|
||||||
=========================================
|
=========================================
|
||||||
|
|
Loading…
Reference in New Issue