Skip to content

Commit 043a83f

Browse files
authored
Better metastore close in mypyc test logic (#21250)
1 parent a475a9a commit 043a83f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mypyc/test/test_run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) ->
278278
librt = has_test_name_tag(testcase.name, "librt")
279279
# Enable experimental features (local librt build also includes experimental features)
280280
experimental_features = has_test_name_tag(testcase.name, "experimental")
281+
result = None
281282
try:
282283
compiler_options = CompilerOptions(
283284
multi_file=self.multi_file,
@@ -313,7 +314,8 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) ->
313314
print(fix_native_line_number(line, testcase.file, testcase.line))
314315
assert False, "Compile error"
315316
finally:
316-
result.manager.metastore.close()
317+
if result is not None:
318+
result.manager.metastore.close()
317319

318320
# Check that serialization works on this IR. (Only on the first
319321
# step because the returned ir only includes updated code.)

0 commit comments

Comments
 (0)