From 692600df9ab0ff7c75ac79803d18f4a98cda1794 Mon Sep 17 00:00:00 2001 From: "tonyg@chromium.org" Date: Thu, 24 Apr 2014 03:09:16 +0000 Subject: [Telemetry] Fix potential flake in testPagesetRepeat. A previous patch of mine (which seems unrelated) triggered flake in os.remove() complaining that the file was still open. It seems like there could be a race with closing the file here. The with-block should make it deterministic. BUG=223572 Review URL: https://codereview.chromium.org/256413002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265825 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/telemetry/telemetry/page/page_runner_unittest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/telemetry/telemetry/page/page_runner_unittest.py b/tools/telemetry/telemetry/page/page_runner_unittest.py index 53740c4..1ae14f7 100644 --- a/tools/telemetry/telemetry/page/page_runner_unittest.py +++ b/tools/telemetry/telemetry/page/page_runner_unittest.py @@ -230,7 +230,8 @@ class PageRunnerTests(unittest.TestCase): results.PrintSummary() self.assertEquals(4, len(results.successes)) self.assertEquals(0, len(results.failures)) - stdout = open(output_file).read() + with open(output_file) as f: + stdout = f.read() self.assertIn('RESULT metric_by_url: blank.html= [1,3] unit', stdout) self.assertIn('RESULT metric_by_url: green_rect.html= [2,4] unit', stdout) self.assertIn('*RESULT metric: metric= [1,2,3,4] unit', stdout) -- cgit v1.1