Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ac4240

Browse files
committed
Issue #18566: Clarify unittest setUp, tearDown doc. Patch by Nitika Agarwal.
1 parent 45278a8 commit 6ac4240

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

Doc/library/unittest.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -674,20 +674,20 @@ Test cases
674674
.. method:: setUp()
675675

676676
Method called to prepare the test fixture. This is called immediately
677-
before calling the test method; any exception raised by this method will
678-
be considered an error rather than a test failure. The default
679-
implementation does nothing.
677+
before calling the test method; other than :exc:`AssertionError` or :exc:`SkipTest`,
678+
any exception raised by this method will be considered an error rather than
679+
a test failure. The default implementation does nothing.
680680

681681

682682
.. method:: tearDown()
683683

684684
Method called immediately after the test method has been called and the
685685
result recorded. This is called even if the test method raised an
686686
exception, so the implementation in subclasses may need to be particularly
687-
careful about checking internal state. Any exception raised by this
688-
method will be considered an error rather than a test failure. This
689-
method will only be called if the :meth:`setUp` succeeds, regardless of
690-
the outcome of the test method. The default implementation does nothing.
687+
careful about checking internal state. Any exception, other than :exc:`AssertionError`
688+
or :exc:`SkipTest`, raised by this method will be considered an error rather than a
689+
test failure. This method will only be called if the :meth:`setUp` succeeds,
690+
regardless of the outcome of the test method. The default implementation does nothing.
691691

692692

693693
.. method:: setUpClass()

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ David Abrahams
1818
Marc Abramowitz
1919
Ron Adam
2020
Ali Afshar
21+
Nitika Agarwal
2122
Jim Ahlstrom
2223
Farhan Ahmad
2324
Matthew Ahrens

0 commit comments

Comments
 (0)