Skip to content

Commit 0bacb9b

Browse files
committed
Fix
1 parent 1eb8eec commit 0bacb9b

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

tests/core/engine_adapter/integration/conftest.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,26 @@ def _create(
105105
gateway,
106106
is_remote=is_remote,
107107
)
108-
ctx.init()
109-
110-
with ctx.engine_adapter.session({}):
111-
yield ctx
112108

109+
skip = False
113110
try:
114-
ctx.cleanup()
111+
ctx.init()
115112
except Exception:
116-
# We need to catch this exception because if there is an error during teardown, pytest-retry aborts immediately
113+
# We need to catch this exception because if there is an error during setup, pytest-retry aborts immediately
117114
# instead of retrying
118-
logger.exception("Context cleanup failed")
115+
logger.exception("Context init failed")
116+
skip = True
117+
118+
if not skip:
119+
with ctx.engine_adapter.session({}):
120+
yield ctx
121+
122+
try:
123+
ctx.cleanup()
124+
except Exception:
125+
# We need to catch this exception because if there is an error during teardown, pytest-retry aborts immediately
126+
# instead of retrying
127+
logger.exception("Context cleanup failed")
119128

120129
return _create
121130

0 commit comments

Comments
 (0)