Skip to content

Commit 37fcbd8

Browse files
committed
add comment
1 parent b5c0174 commit 37fcbd8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

airbyte_cdk/test/standard_tests/models/scenario.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,19 @@ def __str__(self) -> str:
9494
def with_temp_config_file(self) -> Generator[Path, None, None]:
9595
"""Yield a temporary JSON file path containing the config dict and delete it on exit."""
9696
config = self.get_config_dict(empty_if_missing=True)
97-
with tempfile.NamedTemporaryFile(prefix="config-", suffix=".json", mode="w", delete=False) as temp_file:
97+
with tempfile.NamedTemporaryFile(
98+
prefix="config-",
99+
suffix=".json",
100+
mode="w",
101+
delete=False, # Don't fail if cannot delete the file on exit
102+
) as temp_file:
98103
temp_file.write(json.dumps(config))
99104
temp_file.flush()
100105
# Allow the file to be read by other processes
101106
temp_path = Path(temp_file.name)
102107
temp_path.chmod(temp_path.stat().st_mode | 0o444)
103108
yield temp_path
104-
# attempt cleanup, ignore errors
105-
with suppress(OSError):
106-
temp_path.unlink()
109+
110+
# attempt cleanup, ignore errors
111+
with suppress(OSError):
112+
temp_path.unlink()

0 commit comments

Comments
 (0)