Skip to content

Commit 277c8f0

Browse files
author
Johnny Chen
committed
Wrap the rest of file reading operations inside a with block and convert a assertTrue()
usage to self.expect() which is more descriptive. llvm-svn: 116115
1 parent e6acf35 commit 277c8f0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lldb/test/breakpoint_command/TestBreakpointCommand.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ def breakpoint_command_sequence(self):
6565
# Check that the file 'output.txt' exists and contains the string "lldb".
6666

6767
# Read the output file produced by running the program.
68-
output = open('output.txt', 'r').read()
68+
with open('output.txt', 'r') as f:
69+
output = f.read()
6970

70-
self.assertTrue(output.startswith("lldb"),
71-
"File 'output.txt' and the content matches")
71+
self.expect(output, "File 'output.txt' and the content matches", exe=False,
72+
startstr = "lldb")
7273

7374
# Finish the program.
7475
self.runCmd("process continue")

lldb/test/settings/TestSettings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def pass_run_args_and_env_vars(self):
7070
self.runCmd("run", RUN_SUCCEEDED)
7171

7272
# Read the output file produced by running the program.
73-
output = open('output.txt', 'r').read()
73+
with open('output.txt', 'r') as f:
74+
output = f.read()
7475

7576
self.expect(output, exe=False,
7677
substrs = ["argv[1] matches",

0 commit comments

Comments
 (0)