Skip to content

Commit 49c0c59

Browse files
authored
Merge pull request #2944 from nicoddemus/regendoc-norm
Remove gendoc normalization for '=' and '_' headers
2 parents b533c26 + e0d236c commit 49c0c59

21 files changed

+404
-379
lines changed

doc/en/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ PAPEROPT_letter = -D latex_paper_size=letter
1313
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
1414

1515
REGENDOC_ARGS := \
16-
--normalize "/={8,} (.*) ={8,}/======= \1 ========/" \
17-
--normalize "/_{8,} (.*) _{8,}/_______ \1 ________/" \
1816
--normalize "/in \d+.\d+ seconds/in 0.12 seconds/" \
1917
--normalize "@/tmp/pytest-of-.*/pytest-\d+@PYTEST_TMPDIR@" \
2018
--normalize "@pytest-(\d+)\\.[^ ,]+@pytest-\1.x.y@" \

doc/en/assert.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@ to assert that your function returns a certain value. If this assertion fails
2525
you will see the return value of the function call::
2626

2727
$ pytest test_assert1.py
28-
======= test session starts ========
28+
=========================== test session starts ============================
2929
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
3030
rootdir: $REGENDOC_TMPDIR, inifile:
3131
collected 1 item
3232
33-
test_assert1.py F
33+
test_assert1.py F [100%]
3434
35-
======= FAILURES ========
36-
_______ test_function ________
35+
================================= FAILURES =================================
36+
______________________________ test_function _______________________________
3737
3838
def test_function():
3939
> assert f() == 4
4040
E assert 3 == 4
4141
E + where 3 = f()
4242
4343
test_assert1.py:5: AssertionError
44-
======= 1 failed in 0.12 seconds ========
44+
========================= 1 failed in 0.12 seconds =========================
4545

4646
``pytest`` has support for showing the values of the most common subexpressions
4747
including calls, attributes, comparisons, and binary and unary
@@ -168,15 +168,15 @@ when it encounters comparisons. For example::
168168
if you run this module::
169169

170170
$ pytest test_assert2.py
171-
======= test session starts ========
171+
=========================== test session starts ============================
172172
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
173173
rootdir: $REGENDOC_TMPDIR, inifile:
174174
collected 1 item
175175
176-
test_assert2.py F
176+
test_assert2.py F [100%]
177177
178-
======= FAILURES ========
179-
_______ test_set_comparison ________
178+
================================= FAILURES =================================
179+
___________________________ test_set_comparison ____________________________
180180
181181
def test_set_comparison():
182182
set1 = set("1308")
@@ -190,7 +190,7 @@ if you run this module::
190190
E Use -v to get the full diff
191191
192192
test_assert2.py:5: AssertionError
193-
======= 1 failed in 0.12 seconds ========
193+
========================= 1 failed in 0.12 seconds =========================
194194

195195
Special comparisons are done for a number of cases:
196196

@@ -238,9 +238,9 @@ you can run the test module and get the custom output defined in
238238
the conftest file::
239239

240240
$ pytest -q test_foocompare.py
241-
F
242-
======= FAILURES ========
243-
_______ test_compare ________
241+
F [100%]
242+
================================= FAILURES =================================
243+
_______________________________ test_compare _______________________________
244244
245245
def test_compare():
246246
f1 = Foo(1)

doc/en/builtin.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,23 @@ You can ask for available builtin or project-custom
9191
capsys
9292
Enable capturing of writes to sys.stdout/sys.stderr and make
9393
captured output available via ``capsys.readouterr()`` method calls
94-
which return a ``(out, err)`` tuple.
94+
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text``
95+
objects.
96+
capsysbinary
97+
Enable capturing of writes to sys.stdout/sys.stderr and make
98+
captured output available via ``capsys.readouterr()`` method calls
99+
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``bytes``
100+
objects.
95101
capfd
96102
Enable capturing of writes to file descriptors 1 and 2 and make
97103
captured output available via ``capfd.readouterr()`` method calls
98-
which return a ``(out, err)`` tuple.
104+
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be ``text``
105+
objects.
106+
capfdbinary
107+
Enable capturing of write to file descriptors 1 and 2 and make
108+
captured output available via ``capfdbinary.readouterr`` method calls
109+
which return a ``(out, err)`` tuple. ``out`` and ``err`` will be
110+
``bytes`` objects.
99111
doctest_namespace
100112
Inject names into the doctest namespace.
101113
pytestconfig
@@ -104,6 +116,14 @@ You can ask for available builtin or project-custom
104116
Add extra xml properties to the tag for the calling test.
105117
The fixture is callable with ``(name, value)``, with value being automatically
106118
xml-encoded.
119+
caplog
120+
Access and control log capturing.
121+
122+
Captured logs are available through the following methods::
123+
124+
* caplog.text() -> string containing formatted log output
125+
* caplog.records() -> list of logging.LogRecord instances
126+
* caplog.record_tuples() -> list of (logger_name, level, message) tuples
107127
monkeypatch
108128
The returned ``monkeypatch`` fixture provides these
109129
helper methods to modify objects, dictionaries or os.environ::

doc/en/cache.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ First, let's create 50 test invocation of which only 2 fail::
4646
If you run this for the first time you will see two failures::
4747

4848
$ pytest -q
49-
.................F.......F........................
50-
======= FAILURES ========
51-
_______ test_num[17] ________
49+
.................F.......F........................ [100%]
50+
================================= FAILURES =================================
51+
_______________________________ test_num[17] _______________________________
5252
5353
i = 17
5454
@@ -59,7 +59,7 @@ If you run this for the first time you will see two failures::
5959
E Failed: bad luck
6060
6161
test_50.py:6: Failed
62-
_______ test_num[25] ________
62+
_______________________________ test_num[25] _______________________________
6363
6464
i = 25
6565
@@ -75,16 +75,16 @@ If you run this for the first time you will see two failures::
7575
If you then run it with ``--lf``::
7676

7777
$ pytest --lf
78-
======= test session starts ========
78+
=========================== test session starts ============================
7979
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
8080
rootdir: $REGENDOC_TMPDIR, inifile:
8181
collected 50 items
8282
run-last-failure: rerun previous 2 failures
8383
84-
test_50.py FF
84+
test_50.py FF [100%]
8585
86-
======= FAILURES ========
87-
_______ test_num[17] ________
86+
================================= FAILURES =================================
87+
_______________________________ test_num[17] _______________________________
8888
8989
i = 17
9090
@@ -95,7 +95,7 @@ If you then run it with ``--lf``::
9595
E Failed: bad luck
9696
9797
test_50.py:6: Failed
98-
_______ test_num[25] ________
98+
_______________________________ test_num[25] _______________________________
9999
100100
i = 25
101101
@@ -106,8 +106,8 @@ If you then run it with ``--lf``::
106106
E Failed: bad luck
107107
108108
test_50.py:6: Failed
109-
======= 48 tests deselected ========
110-
======= 2 failed, 48 deselected in 0.12 seconds ========
109+
=========================== 48 tests deselected ============================
110+
================= 2 failed, 48 deselected in 0.12 seconds ==================
111111

112112
You have run only the two failing test from the last run, while 48 tests have
113113
not been run ("deselected").
@@ -117,16 +117,16 @@ previous failures will be executed first (as can be seen from the series
117117
of ``FF`` and dots)::
118118

119119
$ pytest --ff
120-
======= test session starts ========
120+
=========================== test session starts ============================
121121
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
122122
rootdir: $REGENDOC_TMPDIR, inifile:
123123
collected 50 items
124124
run-last-failure: rerun previous 2 failures first
125125
126-
test_50.py FF................................................
126+
test_50.py FF................................................ [100%]
127127
128-
======= FAILURES ========
129-
_______ test_num[17] ________
128+
================================= FAILURES =================================
129+
_______________________________ test_num[17] _______________________________
130130
131131
i = 17
132132
@@ -137,7 +137,7 @@ of ``FF`` and dots)::
137137
E Failed: bad luck
138138
139139
test_50.py:6: Failed
140-
_______ test_num[25] ________
140+
_______________________________ test_num[25] _______________________________
141141
142142
i = 25
143143
@@ -148,7 +148,7 @@ of ``FF`` and dots)::
148148
E Failed: bad luck
149149
150150
test_50.py:6: Failed
151-
======= 2 failed, 48 passed in 0.12 seconds ========
151+
=================== 2 failed, 48 passed in 0.12 seconds ====================
152152

153153
.. _`config.cache`:
154154

@@ -182,9 +182,9 @@ If you run this command once, it will take a while because
182182
of the sleep::
183183

184184
$ pytest -q
185-
F
186-
======= FAILURES ========
187-
_______ test_function ________
185+
F [100%]
186+
================================= FAILURES =================================
187+
______________________________ test_function _______________________________
188188
189189
mydata = 42
190190
@@ -199,9 +199,9 @@ If you run it a second time the value will be retrieved from
199199
the cache and this will be quick::
200200

201201
$ pytest -q
202-
F
203-
======= FAILURES ========
204-
_______ test_function ________
202+
F [100%]
203+
================================= FAILURES =================================
204+
______________________________ test_function _______________________________
205205
206206
mydata = 42
207207
@@ -222,7 +222,7 @@ You can always peek at the content of the cache using the
222222
``--cache-show`` command line option::
223223

224224
$ py.test --cache-show
225-
======= test session starts ========
225+
=========================== test session starts ============================
226226
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
227227
rootdir: $REGENDOC_TMPDIR, inifile:
228228
cachedir: $REGENDOC_TMPDIR/.cache
@@ -232,7 +232,7 @@ You can always peek at the content of the cache using the
232232
example/value contains:
233233
42
234234
235-
======= no tests ran in 0.12 seconds ========
235+
======================= no tests ran in 0.12 seconds =======================
236236

237237
Clearing Cache content
238238
-------------------------------

doc/en/capture.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ and running this module will show you precisely the output
6363
of the failing function and hide the other one::
6464

6565
$ pytest
66-
======= test session starts ========
66+
=========================== test session starts ============================
6767
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
6868
rootdir: $REGENDOC_TMPDIR, inifile:
6969
collected 2 items
7070
71-
test_module.py .F
71+
test_module.py .F [100%]
7272
73-
======= FAILURES ========
74-
_______ test_func2 ________
73+
================================= FAILURES =================================
74+
________________________________ test_func2 ________________________________
7575
7676
def test_func2():
7777
> assert False
@@ -80,7 +80,7 @@ of the failing function and hide the other one::
8080
test_module.py:9: AssertionError
8181
-------------------------- Captured stdout setup ---------------------------
8282
setting up <function test_func2 at 0xdeadbeef>
83-
======= 1 failed, 1 passed in 0.12 seconds ========
83+
==================== 1 failed, 1 passed in 0.12 seconds ====================
8484

8585
Accessing captured output from a test function
8686
---------------------------------------------------

doc/en/doctest.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ and another like this::
6161
then you can just invoke ``pytest`` without command line options::
6262

6363
$ pytest
64-
======= test session starts ========
64+
=========================== test session starts ============================
6565
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
6666
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
6767
collected 1 item
6868
69-
mymodule.py .
69+
mymodule.py . [100%]
7070
71-
======= 1 passed in 0.12 seconds ========
71+
========================= 1 passed in 0.12 seconds =========================
7272

7373
It is possible to use fixtures using the ``getfixture`` helper::
7474

0 commit comments

Comments
 (0)