File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
instrumentation/opentelemetry-instrumentation-fastapi/tests Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1515# pylint: disable=too-many-lines
1616
1717import unittest
18+ from contextlib import ExitStack
1819from timeit import default_timer
1920from unittest .mock import Mock , patch
2021
@@ -173,10 +174,11 @@ def setUp(self):
173174 self ._client = TestClient (self ._app , base_url = "https://testserver:443" )
174175 # run the lifespan, initialize the middleware stack
175176 # this is more in-line with what happens in a real application when the server starts up
176- self ._client_teardown = self ._client .__enter__ () # pylint: disable=unnecessary-dunder-call
177+ self ._exit_stack = ExitStack ()
178+ self ._exit_stack .enter_context (self ._client )
177179
178180 def tearDown (self ):
179- self ._client_teardown . __exit__ ( None , None , None ) # pylint: disable=unnecessary-dunder-call
181+ self ._exit_stack . close ()
180182 super ().tearDown ()
181183 self .env_patch .stop ()
182184 self .exclude_patch .stop ()
You can’t perform that action at this time.
0 commit comments