profile_file = os.path.join(
util.GetUnittestDataDir(), 'perf_report_output.txt')
- perf_report_output = open(profile_file, 'r').read()
+ with open(profile_file) as f:
+ perf_report_output = f.read()
mock_popen = simple_mock.MockObject()
mock_popen.ExpectCall('communicate').WillReturn([perf_report_output])
perf_profiler.subprocess = mock_subprocess
try:
self.assertEqual(
- perf_profiler.PerfProfiler.GetTopSamples('linux', profile_file, 10),
+ perf_profiler.PerfProfiler.GetTopSamples(profile_file, 10),
{ 'v8::internal::StaticMarkingVisitor::MarkMapContents': 63615201,
'v8::internal::RelocIterator::next': 38271931,
'v8::internal::LAllocator::MeetConstraintsBetween': 42913933,