Skip to content

Commit 3cdbb18

Browse files
committed
#2692: Document setup/teardown behaviour when using unittest-based suites
1 parent 4cb60da commit 3cdbb18

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/en/unittest.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,13 @@ was executed ahead of the ``test_method``.
233233
overwrite ``unittest.TestCase`` ``__call__`` or ``run``, they need to
234234
to overwrite ``debug`` in the same way (this is also true for standard
235235
unittest).
236+
237+
.. note::
238+
239+
Due to architectural differences between the two frameworks, setup and
240+
teardown for ``unittest``-based tests is performed during the ``call`` phase
241+
of testing instead of in ``pytest``'s standard ``setup`` and ``teardown``
242+
stages. This can be important to understand in some situations, particularly
243+
when reasoning about errors. For example, if a ``unittest``-based suite
244+
exhibits errors during setup, ``pytest`` will report no errors during its
245+
``setup`` phase and will instead raise the error during ``call``.

0 commit comments

Comments
 (0)