@@ -140,6 +140,48 @@ will be shown (because KeyboardInterrupt is caught by pytest). By using this
140
140
option you make sure a trace is shown.
141
141
142
142
143
+ .. _`pytest.detailed_failed_tests_usage` :
144
+
145
+ Detailed summary report
146
+ -----------------------
147
+
148
+ .. versionadded :: 2.9
149
+
150
+ The ``-r `` flag can be used to display test results summary at the end of the test session,
151
+ making it easy in large test suites to get a clear picture of all failures, skips, xfails, etc.
152
+
153
+ Example::
154
+
155
+ $ pytest -ra
156
+ ======================== test session starts ========================
157
+ ...
158
+ ====================== short test summary info ======================
159
+ FAIL summary\test_foo.py::test_1
160
+ SKIP [1] summary\test_foo.py:12: not supported in this platform
161
+ XPASS summary\test_bar.py::test_4 flaky
162
+
163
+ ===== 1 failed, 1 passed, 1 skipped, 1 xpassed in 0.08 seconds ======
164
+
165
+
166
+ The ``-r `` options accepts a number of characters after it, with ``a `` used above meaning "all except passes".
167
+
168
+ Here is the full list of available characters that can be used:
169
+
170
+ - ``f `` - failed
171
+ - ``E `` - error
172
+ - ``s `` - skipped
173
+ - ``x `` - xfailed
174
+ - ``X `` - xpassed
175
+ - ``p `` - passed
176
+ - ``P `` - passed with output
177
+ - ``a `` - all except ``pP ``
178
+
179
+ More than one character can be used, so for example to only see failed and skipped tests, you can execute::
180
+
181
+ $ pytest -rfs
182
+
183
+
184
+
143
185
.. _pdb-option :
144
186
145
187
Dropping to PDB _ (Python Debugger) on failures
@@ -527,40 +569,3 @@ hook was invoked::
527
569
528
570
529
571
.. include :: links.inc
530
-
531
- .. _`pytest.detailed_failed_tests_usage` :
532
-
533
- Detailed Summary Report of Failed,Skipped,xfailed tests
534
- --------------------------------------------------------
535
-
536
- .. versionadded :: 2.9
537
-
538
- When there are more than 200 tests in a file and pytest is run and many tests are failing,then it is difficult to find which tests
539
- are failing and the person just doesn't wants to scroll and see each and every failed test.
540
-
541
-
542
- This way the failed test can be missed,so pytest has a flag known as -r to denote the failed,skipped,xfailed tests.
543
-
544
- To create an extra summary report at the end of the output, use this invocation::
545
-
546
- python -r chars
547
-
548
- where chars are :
549
- - (f)ailed,
550
- - (E)error,
551
- - (s)skipped,
552
- - (x)failed,
553
- - (X)passed,
554
- - (p)passed,
555
- - (P)passed with output,
556
- - (a)all except pP.
557
-
558
- **Examples: **
559
-
560
- - To show extra info on xfailed, xpassed, and skipped tests::
561
-
562
- pytest -r xXs
563
-
564
- - To show extra info on all tests except (p)assed and (P)assed with output ,this is the most commonly used command::
565
-
566
- pytest -r a
0 commit comments