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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/views/buildbot_results_unittest.py

Issue 546133003: Reformat webkitpy.layout_tests w/ format-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2012 Google Inc. All rights reserved. 1 # Copyright (C) 2012 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 22 matching lines...) Expand all
33 33
34 from webkitpy.layout_tests.models import test_expectations 34 from webkitpy.layout_tests.models import test_expectations
35 from webkitpy.layout_tests.models import test_failures 35 from webkitpy.layout_tests.models import test_failures
36 from webkitpy.layout_tests.models import test_run_results 36 from webkitpy.layout_tests.models import test_run_results
37 from webkitpy.layout_tests.models import test_run_results 37 from webkitpy.layout_tests.models import test_run_results
38 from webkitpy.layout_tests.models import test_run_results_unittest 38 from webkitpy.layout_tests.models import test_run_results_unittest
39 from webkitpy.layout_tests.views import buildbot_results 39 from webkitpy.layout_tests.views import buildbot_results
40 40
41 41
42 class BuildBotPrinterTests(unittest.TestCase): 42 class BuildBotPrinterTests(unittest.TestCase):
43
43 def assertEmpty(self, stream): 44 def assertEmpty(self, stream):
44 self.assertFalse(stream.getvalue()) 45 self.assertFalse(stream.getvalue())
45 46
46 def assertNotEmpty(self, stream): 47 def assertNotEmpty(self, stream):
47 self.assertTrue(stream.getvalue()) 48 self.assertTrue(stream.getvalue())
48 49
49 def get_printer(self): 50 def get_printer(self):
50 stream = StringIO.StringIO() 51 stream = StringIO.StringIO()
51 printer = buildbot_results.BuildBotPrinter(stream, debug_logging=True) 52 printer = buildbot_results.BuildBotPrinter(stream, debug_logging=True)
52 return printer, stream 53 return printer, stream
53 54
54 def test_print_unexpected_results(self): 55 def test_print_unexpected_results(self):
55 port = MockHost().port_factory.get('test') 56 port = MockHost().port_factory.get('test')
56 printer, out = self.get_printer() 57 printer, out = self.get_printer()
57 58
58 # test everything running as expected 59 # test everything running as expected
59 DASHED_LINE = "-" * 78 + "\n" 60 DASHED_LINE = '-' * 78 + '\n'
60 summary = test_run_results_unittest.summarized_results(port, expected=Tr ue, passing=False, flaky=False) 61 summary = test_run_results_unittest.summarized_results(port, expected=Tr ue, passing=False, flaky=False)
61 printer.print_unexpected_results(summary) 62 printer.print_unexpected_results(summary)
62 self.assertEqual(out.getvalue(), DASHED_LINE) 63 self.assertEqual(out.getvalue(), DASHED_LINE)
63 64
64 # test failures 65 # test failures
65 printer, out = self.get_printer() 66 printer, out = self.get_printer()
66 summary = test_run_results_unittest.summarized_results(port, expected=Fa lse, passing=False, flaky=False) 67 summary = test_run_results_unittest.summarized_results(port, expected=Fa lse, passing=False, flaky=False)
67 printer.print_unexpected_results(summary) 68 printer.print_unexpected_results(summary)
68 self.assertNotEmpty(out) 69 self.assertNotEmpty(out)
69 70
(...skipping 18 matching lines...) Expand all
88 printer.print_unexpected_results(summary) 89 printer.print_unexpected_results(summary)
89 output = out.getvalue() 90 output = out.getvalue()
90 self.assertTrue(output) 91 self.assertTrue(output)
91 self.assertTrue(output.find('Skip') == -1) 92 self.assertTrue(output.find('Skip') == -1)
92 93
93 def test_print_results(self): 94 def test_print_results(self):
94 port = MockHost().port_factory.get('test') 95 port = MockHost().port_factory.get('test')
95 printer, out = self.get_printer() 96 printer, out = self.get_printer()
96 initial_results = test_run_results_unittest.run_results(port) 97 initial_results = test_run_results_unittest.run_results(port)
97 full_summary = test_run_results_unittest.summarized_results(port, expect ed=False, passing=True, flaky=False) 98 full_summary = test_run_results_unittest.summarized_results(port, expect ed=False, passing=True, flaky=False)
98 failing_summary = test_run_results_unittest.summarized_results(port, exp ected=False, passing=True, flaky=False, only_include_failing=True) 99 failing_summary = test_run_results_unittest.summarized_results(
99 details = test_run_results.RunDetails(failing_summary['num_regressions'] , full_summary, failing_summary, initial_results, None) 100 port,
101 expected=False,
102 passing=True,
103 flaky=False,
104 only_include_failing=True)
105 details = test_run_results.RunDetails(
106 failing_summary['num_regressions'],
107 full_summary,
108 failing_summary,
109 initial_results,
110 None)
100 printer.print_results(details) 111 printer.print_results(details)
101 self.assertTrue(out.getvalue().find('but passed') != -1) 112 self.assertTrue(out.getvalue().find('but passed') != -1)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698