Skip to content

Commit

Permalink
code review: second part for file write using ctx mgr
Browse files Browse the repository at this point in the history
  • Loading branch information
tarilabs committed Sep 4, 2023
1 parent b7c1b0b commit c8d3f36
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/e2e/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,8 @@ def test_hot_reload():
assert found_rule_1_in_out

data = original_data.replace('- action: "value_a"', '- action: "value_b"')
fout1 = open(rulebook, "wt")
fout1.write(data)
fout1.close()
with open(rulebook, "wt") as file:
file.write(data)

start = time.time()
while line := process.stdout.readline():
Expand All @@ -277,8 +276,7 @@ def test_hot_reload():
if time.time() - start > DEFAULT_CMD_TIMEOUT:
process.kill()

fout2 = open(rulebook, "wt")
fout2.write(original_data)
fout2.close()
with open(rulebook, "wt") as file:
file.write(original_data)

assert found_rule_2_in_out

0 comments on commit c8d3f36

Please sign in to comment.