Skip to content

Commit 647da93

Browse files
committed
Mention omission of fixtures with leading '_', closes pytest-dev#3398
1 parent 36f6687 commit 647da93

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

_pytest/helpconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def showhelp(config):
138138
tw.line("to see available markers type: pytest --markers")
139139
tw.line("to see available fixtures type: pytest --fixtures")
140140
tw.line("(shown according to specified file_or_dir or current dir "
141-
"if not specified)")
141+
"if not specified; fixtures with leading '_' are only shown "
142+
"with the '-v' option")
142143

143144
for warningreport in reporter.stats.get('warnings', []):
144145
tw.line("warning : " + warningreport.message, red=True)

_pytest/python.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def pytest_addoption(parser):
7575
group = parser.getgroup("general")
7676
group.addoption('--fixtures', '--funcargs',
7777
action="store_true", dest="showfixtures", default=False,
78-
help="show available fixtures, sorted by plugin appearance")
78+
help="show available fixtures, sorted by plugin appearance "
79+
"(fixtures with leading '_' are only shown with '-v')")
7980
group.addoption(
8081
'--fixtures-per-test',
8182
action="store_true",

doc/en/builtin.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For information on plugin hooks and objects, see :ref:`plugins`.
1212

1313
For information on the ``pytest.mark`` mechanism, see :ref:`mark`.
1414

15-
For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures, type::
15+
For information about fixtures, see :ref:`fixtures`. To see a complete list of available fixtures (add ``-v`` to also see fixtures with leading ``_``), type ::
1616

1717
$ pytest -q --fixtures
1818
cache

doc/en/fixture.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ with a list of available function arguments.
111111

112112
.. note::
113113

114-
You can always issue::
114+
You can always issue ::
115115

116116
pytest --fixtures test_simplefactory.py
117117

118-
to see available fixtures.
118+
to see available fixtures (fixtures with leading ``_`` are only shown if you add the ``-v`` option).
119119

120120
Fixtures: a prime example of dependency injection
121121
---------------------------------------------------
@@ -141,7 +141,7 @@ automatically gets discovered by pytest. The discovery of
141141
fixture functions starts at test classes, then test modules, then
142142
``conftest.py`` files and finally builtin and third party plugins.
143143

144-
You can also use the ``conftest.py`` file to implement
144+
You can also use the ``conftest.py`` file to implement
145145
:ref:`local per-directory plugins <conftest.py plugins>`.
146146

147147
Sharing test data

doc/en/getting-started.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ Find out what kind of builtin :ref:`pytest fixtures <fixtures>` exist with the c
166166

167167
pytest --fixtures # shows builtin and custom fixtures
168168

169+
Note that this command omits fixtures with leading ``_`` unless the ``-v`` option is added.
170+
169171
Continue reading
170172
-------------------------------------
171173

doc/en/test/plugin/terminal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ command line options
2323
``--full-trace``
2424
don't cut any tracebacks (default is to cut).
2525
``--fixtures``
26-
show available function arguments, sorted by plugin
26+
show available fixtures, sorted by plugin appearance (fixtures with leading ``_`` are only shown with '-v')
2727

2828
Start improving this plugin in 30 seconds
2929
=========================================

0 commit comments

Comments
 (0)