From 3cdbb1854f802bc3250ebcf3014fc1241389c48c Mon Sep 17 00:00:00 2001 From: Owen Tuz Date: Sat, 21 Oct 2017 23:12:49 +0100 Subject: [PATCH] #2692: Document setup/teardown behaviour when using unittest-based suites --- doc/en/unittest.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/en/unittest.rst b/doc/en/unittest.rst index 92b9e653e..db1692029 100644 --- a/doc/en/unittest.rst +++ b/doc/en/unittest.rst @@ -233,3 +233,13 @@ was executed ahead of the ``test_method``. overwrite ``unittest.TestCase`` ``__call__`` or ``run``, they need to to overwrite ``debug`` in the same way (this is also true for standard unittest). + +.. note:: + + Due to architectural differences between the two frameworks, setup and + teardown for ``unittest``-based tests is performed during the ``call`` phase + of testing instead of in ``pytest``'s standard ``setup`` and ``teardown`` + stages. This can be important to understand in some situations, particularly + when reasoning about errors. For example, if a ``unittest``-based suite + exhibits errors during setup, ``pytest`` will report no errors during its + ``setup`` phase and will instead raise the error during ``call``.