Path 1: 7 calls (1.0)

test_app_tearing_down..cleanup def (1) test_app_tearing_down_with_previous_exception..cleanup def (1) test_app_tearing_down_with_handl...

test_app_tearing_down..cleanup def (1) test_app_tearing_down_with_previous_exception..cleanup def (1) test_app_tearing_down_with_handl...

1@setupmethod
2    def teardown_appcontext(self, f: T_teardown) -> T_teardown:
3        """Registers a function to be called when the application
4        context is popped. The application context is typically popped
5        after the request context for each request, at the end of CLI
6        commands, or after a manually pushed context ends.
7
8        .. code-block:: python
9
10            with app.app_context():
11                ...
12
13        When the ``with`` block exits (or ``ctx.pop()`` is called), the
14        teardown functions are called just before the app context is
15        made inactive. Since a request context typically also manages an
16        application context it would also be called when you pop a
17        request context.
18
19        When a teardown function was called because of an unhandled
20        exception it will be passed an error object. If an
21        :meth:`errorhandler` is registered, it will handle the exception
22        and the teardown will not receive it.
23
24        Teardown functions must avoid raising exceptions. If they
25        execute code that might fail they must surround that code with a
26        ``try``/``except`` block and log any errors.
27
28        The return values of teardown functions are ignored.
29
30        .. versionadded:: 0.9
31        """
32        self.teardown_appcontext_funcs.append(f)
33        return f