Skip to content

Commit b61cbc4

Browse files
authored
Merge pull request #2859 from OwenTuz/issue-2692-document-setup-teardown-mismatch-in-unittest-integration
2692.docs document setup/teardown behaviour when using unittest-based su…
2 parents 531e0dc + 3cdbb18 commit b61cbc4

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)