Skip to content

Commit

Permalink
Refactor file handling in test_runexecutor.py for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
younghojan committed Sep 5, 2024
1 parent 34f57f1 commit 2fd26ff
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions benchexec/test_runexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1308,19 +1308,17 @@ def test_triple_nested_runexec(self):
self.check_exitcode(
outer_result, 0, "exit code of outer runexec is not zero"
)
with open(mid_output_file, "rb") as mid_output_file:
self.assertIn(
b"returnvalue=0", mid_output_file.read().strip().splitlines()
)
with open(mid_output_file, "r") as f:
self.assertIn("returnvalue=0", f.read().strip().splitlines())
self.assertTrue(
os.path.exists(test_file),
f"File '{test_file}' removed, output was:\n" + "\n".join(outer_output),
)
with open(test_file, "rb") as test_file:
test_token = test_file.read()
with open(test_file, "r") as f:
test_token = f.read()
self.assertEqual(
test_token.strip(),
b"TEST_TOKEN",
"TEST_TOKEN",
f"File '{test_file}' content is incorrect. Expected 'TEST_TOKEN', but got:\n{test_token}",
)

Expand Down

0 comments on commit 2fd26ff

Please sign in to comment.