Skip to content

Commit 0bd02cd

Browse files
authored
Ignore PytestUnknownMark warning when generating docs (#5234)
Ignore PytestUnknownMark warning when generating docs
2 parents 5eeb5ee + 5d76869 commit 0bd02cd

File tree

10 files changed

+38
-22
lines changed

10 files changed

+38
-22
lines changed

doc/en/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ clean:
4343

4444
regen: REGENDOC_FILES:=*.rst */*.rst
4545
regen:
46-
PYTHONDONTWRITEBYTECODE=1 PYTEST_ADDOPTS=-pno:hypothesis COLUMNS=76 regendoc --update ${REGENDOC_FILES} ${REGENDOC_ARGS}
46+
PYTHONDONTWRITEBYTECODE=1 PYTEST_ADDOPTS="-pno:hypothesis -Wignore::pytest.PytestUnknownMarkWarning" COLUMNS=76 regendoc --update ${REGENDOC_FILES} ${REGENDOC_ARGS}
4747

4848
html:
4949
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html

doc/en/builtin.rst

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,47 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
2727
name of your plugin or application to avoid clashes with other cache users.
2828
2929
Values can be any object handled by the json stdlib module.
30+
3031
capsys
3132
Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``.
3233
3334
The captured output is made available via ``capsys.readouterr()`` method
3435
calls, which return a ``(out, err)`` namedtuple.
3536
``out`` and ``err`` will be ``text`` objects.
37+
3638
capsysbinary
3739
Enable bytes capturing of writes to ``sys.stdout`` and ``sys.stderr``.
3840
3941
The captured output is made available via ``capsysbinary.readouterr()``
4042
method calls, which return a ``(out, err)`` namedtuple.
4143
``out`` and ``err`` will be ``bytes`` objects.
44+
4245
capfd
4346
Enable text capturing of writes to file descriptors ``1`` and ``2``.
4447
4548
The captured output is made available via ``capfd.readouterr()`` method
4649
calls, which return a ``(out, err)`` namedtuple.
4750
``out`` and ``err`` will be ``text`` objects.
51+
4852
capfdbinary
4953
Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
5054
5155
The captured output is made available via ``capfd.readouterr()`` method
5256
calls, which return a ``(out, err)`` namedtuple.
5357
``out`` and ``err`` will be ``byte`` objects.
54-
doctest_namespace
58+
59+
doctest_namespace [session scope]
5560
Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
56-
pytestconfig
61+
62+
pytestconfig [session scope]
5763
Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
5864
5965
Example::
6066
6167
def test_foo(pytestconfig):
6268
if pytestconfig.getoption("verbose") > 0:
6369
...
70+
6471
record_property
6572
Add an extra properties the calling test.
6673
User properties become part of the test report and are available to the
@@ -72,10 +79,12 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
7279
7380
def test_function(record_property):
7481
record_property("example_key", 1)
82+
7583
record_xml_attribute
7684
Add extra xml attributes to the tag for the calling test.
7785
The fixture is callable with ``(name, value)``, with value being
7886
automatically xml-encoded
87+
7988
caplog
8089
Access and control log capturing.
8190
@@ -85,6 +94,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
8594
* caplog.records -> list of logging.LogRecord instances
8695
* caplog.record_tuples -> list of (logger_name, level, message) tuples
8796
* caplog.clear() -> clear captured records and formatted log output string
97+
8898
monkeypatch
8999
The returned ``monkeypatch`` fixture provides these
90100
helper methods to modify objects, dictionaries or os.environ::
@@ -102,15 +112,19 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
102112
test function or fixture has finished. The ``raising``
103113
parameter determines if a KeyError or AttributeError
104114
will be raised if the set/deletion operation has no target.
115+
105116
recwarn
106117
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
107118
108119
See http://docs.python.org/library/warnings.html for information
109120
on warning categories.
110-
tmpdir_factory
121+
122+
tmpdir_factory [session scope]
111123
Return a :class:`_pytest.tmpdir.TempdirFactory` instance for the test session.
112-
tmp_path_factory
124+
125+
tmp_path_factory [session scope]
113126
Return a :class:`_pytest.tmpdir.TempPathFactory` instance for the test session.
127+
114128
tmpdir
115129
Return a temporary directory path object
116130
which is unique to each test function invocation,
@@ -119,6 +133,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
119133
path object.
120134
121135
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
136+
122137
tmp_path
123138
Return a temporary directory path object
124139
which is unique to each test function invocation,
@@ -130,6 +145,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
130145
131146
in python < 3.6 this is a pathlib2.Path
132147
148+
133149
no tests ran in 0.12 seconds
134150
135151
You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like::

doc/en/cache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ filtering:
286286
=========================== test session starts ============================
287287
platform linux -- Python 3.x.y, pytest-4.x.y, py-1.x.y, pluggy-0.x.y
288288
cachedir: $PYTHON_PREFIX/.pytest_cache
289-
rootdir: $REGENDOC_TMPDIR, inifile:
289+
rootdir: $REGENDOC_TMPDIR
290290
cachedir: $PYTHON_PREFIX/.pytest_cache
291291
----------------------- cache values for 'example/*' -----------------------
292292
example/value contains:

doc/en/example/markers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,9 @@ then you will see two tests skipped and two executed tests as expected:
619619
collected 4 items
620620
621621
test_plat.py s.s. [100%]
622+
622623
========================= short test summary info ==========================
623624
SKIPPED [2] $REGENDOC_TMPDIR/conftest.py:13: cannot run on platform linux
624-
625625
=================== 2 passed, 2 skipped in 0.12 seconds ====================
626626
627627
Note that if you specify a platform via the marker-command line option like this:

doc/en/example/parametrize.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,9 @@ If you run this with reporting for skips enabled:
492492
collected 2 items
493493
494494
test_module.py .s [100%]
495+
495496
========================= short test summary info ==========================
496497
SKIPPED [1] $REGENDOC_TMPDIR/conftest.py:11: could not import 'opt2'
497-
498498
=================== 1 passed, 1 skipped in 0.12 seconds ====================
499499
500500
You'll see that we don't have an ``opt2`` module and thus the second test run

doc/en/example/reportingdemo.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ Here is a nice run of several failures and how ``pytest`` presents things:
182182
E Omitting 1 identical items, use -vv to show
183183
E Differing items:
184184
E {'b': 1} != {'b': 2}
185-
E Left contains more items:
185+
E Left contains 1 more item:
186186
E {'c': 0}
187-
E Right contains more items:
187+
E Right contains 1 more item:
188188
E {'d': 0}...
189189
E
190190
E ...Full output truncated (2 lines hidden), use '-vv' to show
@@ -215,7 +215,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
215215
def test_eq_longer_list(self):
216216
> assert [1, 2] == [1, 2, 3]
217217
E assert [1, 2] == [1, 2, 3]
218-
E Right contains more items, first extra item: 3
218+
E Right contains one more item: 3
219219
E Use -v to get the full diff
220220
221221
failure_demo.py:80: AssertionError

doc/en/example/simple.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ and when running it will see a skipped "slow" test:
194194
collected 2 items
195195
196196
test_module.py .s [100%]
197+
197198
========================= short test summary info ==========================
198199
SKIPPED [1] test_module.py:8: need --runslow option to run
199-
200200
=================== 1 passed, 1 skipped in 0.12 seconds ====================
201201
202202
Or run it including the ``slow`` marked test:

doc/en/skipping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ Running it with the report-on-xfail option gives this output:
352352
collected 7 items
353353
354354
xfail_demo.py xxxxxxx [100%]
355+
355356
========================= short test summary info ==========================
356357
XFAIL xfail_demo.py::test_hello
357358
XFAIL xfail_demo.py::test_hello2
@@ -365,7 +366,6 @@ Running it with the report-on-xfail option gives this output:
365366
XFAIL xfail_demo.py::test_hello6
366367
reason: reason
367368
XFAIL xfail_demo.py::test_hello7
368-
369369
======================== 7 xfailed in 0.12 seconds =========================
370370
371371
.. _`skip/xfail with parametrize`:

doc/en/usage.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ Example:
231231
XFAIL test_example.py::test_xfail
232232
reason: xfailing this test
233233
XPASS test_example.py::test_xpass always xfail
234-
ERROR test_example.py::test_error
235-
FAILED test_example.py::test_fail
236-
1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds
234+
ERROR test_example.py::test_error - assert 0
235+
FAILED test_example.py::test_fail - assert 0
236+
= 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds =
237237
238238
The ``-r`` options accepts a number of characters after it, with ``a`` used
239239
above meaning "all except passes".
@@ -281,9 +281,9 @@ More than one character can be used, so for example to only see failed and skipp
281281
282282
test_example.py:14: AssertionError
283283
========================= short test summary info ==========================
284-
FAILED test_example.py::test_fail
284+
FAILED test_example.py::test_fail - assert 0
285285
SKIPPED [1] $REGENDOC_TMPDIR/test_example.py:23: skipping this test
286-
1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds
286+
= 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds =
287287
288288
Using ``p`` lists the passing tests, whilst ``P`` adds an extra section "PASSES" with those tests that passed but had
289289
captured output:
@@ -316,13 +316,13 @@ captured output:
316316
E assert 0
317317
318318
test_example.py:14: AssertionError
319-
========================= short test summary info ==========================
320-
PASSED test_example.py::test_ok
321319
================================== PASSES ==================================
322320
_________________________________ test_ok __________________________________
323321
--------------------------- Captured stdout call ---------------------------
324322
ok
325-
1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds
323+
========================= short test summary info ==========================
324+
PASSED test_example.py::test_ok
325+
= 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds =
326326
327327
.. _pdb-option:
328328

doc/en/warnings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ defines an ``__init__`` constructor, as this prevents the class from being insta
400400
401401
============================= warnings summary =============================
402402
test_pytest_warnings.py:1
403-
$REGENDOC_TMPDIR/test_pytest_warnings.py:1: PytestWarning: cannot collect test class 'Test' because it has a __init__ constructor
403+
$REGENDOC_TMPDIR/test_pytest_warnings.py:1: PytestCollectionWarning: cannot collect test class 'Test' because it has a __init__ constructor
404404
class Test:
405405
406406
-- Docs: https://docs.pytest.org/en/latest/warnings.html

0 commit comments

Comments
 (0)