aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/py/bazel/bazel_windows_cpp_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/py/bazel/bazel_windows_cpp_test.py')
-rw-r--r--src/test/py/bazel/bazel_windows_cpp_test.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/py/bazel/bazel_windows_cpp_test.py b/src/test/py/bazel/bazel_windows_cpp_test.py
index 3d21929205..40fe50905c 100644
--- a/src/test/py/bazel/bazel_windows_cpp_test.py
+++ b/src/test/py/bazel/bazel_windows_cpp_test.py
@@ -436,14 +436,14 @@ class BazelWindowsCppTest(test_base.TestBase):
self.AssertFileContentContains(def_file, 'hello_C')
def AssertFileContentContains(self, file_path, entry):
- f = open(file_path, 'r')
- if entry not in f.read():
- self.fail('File "%s" does not contain "%s"' % (file_path, entry))
+ with open(file_path, 'r') as f:
+ if entry not in f.read():
+ self.fail('File "%s" does not contain "%s"' % (file_path, entry))
def AssertFileContentNotContains(self, file_path, entry):
- f = open(file_path, 'r')
- if entry in f.read():
- self.fail('File "%s" does contain "%s"' % (file_path, entry))
+ with open(file_path, 'r') as f:
+ if entry in f.read():
+ self.fail('File "%s" does contain "%s"' % (file_path, entry))
def testWinDefFileAttribute(self):
self.ScratchFile('WORKSPACE')