Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: tools/telemetry/telemetry/page/page_set_unittest.py

Issue 15846013: [Telemetry] Fix TestPageSet.testSimpleSet on windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/page_set_unittest.py
diff --git a/tools/telemetry/telemetry/page/page_set_unittest.py b/tools/telemetry/telemetry/page/page_set_unittest.py
index 28beab10990944e64b82af24a149e91b9bdfd15f..660f8f873918f4ae79c8667fdd504652f18b3f67 100644
--- a/tools/telemetry/telemetry/page/page_set_unittest.py
+++ b/tools/telemetry/telemetry/page/page_set_unittest.py
@@ -28,18 +28,20 @@ simple_set = """
class TestPageSet(unittest.TestCase):
def testSimpleSet(self):
- with tempfile.NamedTemporaryFile() as f:
- f.write(simple_archive_info)
- f.flush()
- archive_data_file = f.name
+ try:
+ with tempfile.NamedTemporaryFile(delete=False) as f:
+ f.write(simple_archive_info)
- with tempfile.NamedTemporaryFile() as f2:
- f2.write(simple_set % archive_data_file)
- f2.flush()
- ps = page_set.PageSet.FromFile(f2.name)
+ with tempfile.NamedTemporaryFile(delete=False) as f2:
+ f2.write(simple_set % f.name.replace('\\', '\\\\'))
+
+ ps = page_set.PageSet.FromFile(f2.name)
+ finally:
+ os.remove(f.name)
+ os.remove(f2.name)
self.assertEquals('hello', ps.description)
- self.assertEquals(archive_data_file, ps.archive_data_file)
+ self.assertEquals(f.name, ps.archive_data_file)
self.assertEquals(2, len(ps.pages))
self.assertEquals('http://www.foo.com/', ps.pages[0].url)
self.assertEquals('http://www.bar.com/', ps.pages[1].url)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698