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

Unified Diff: tools/telemetry/telemetry/testing/gtest_progress_reporter_unittest.py

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
Index: tools/telemetry/telemetry/testing/gtest_progress_reporter_unittest.py
diff --git a/tools/telemetry/telemetry/testing/gtest_progress_reporter_unittest.py b/tools/telemetry/telemetry/testing/gtest_progress_reporter_unittest.py
deleted file mode 100644
index a6bdcb213f8d8d26e3d36de6124777e25cb9011f..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/testing/gtest_progress_reporter_unittest.py
+++ /dev/null
@@ -1,111 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import sys
-import unittest
-
-from telemetry.core import exceptions
-from telemetry.testing import gtest_progress_reporter
-from telemetry.testing import simple_mock
-from telemetry.testing import stream
-
-
-try:
- raise exceptions.IntentionalException()
-except exceptions.IntentionalException:
- INTENTIONAL_EXCEPTION = sys.exc_info()
-
-
-class TestFoo(unittest.TestCase):
- # Test method doesn't have test- prefix intentionally. This is so that
- # run_test script won't run this test.
- def runTezt(self):
- pass
-
-
-class TestResultWithSuccesses(unittest.TestResult):
- def __init__(self):
- super(TestResultWithSuccesses, self).__init__()
- self.successes = []
-
- def addSuccess(self, test):
- super(TestResultWithSuccesses, self).addSuccess(test)
- self.successes.append(test)
-
-
-class GTestProgressReporterTest(unittest.TestCase):
- def setUp(self):
- super(GTestProgressReporterTest, self).setUp()
- self._stream = stream.TestOutputStream()
- self._formatter = gtest_progress_reporter.GTestProgressReporter(
- self._stream)
-
- self._mock_timer = simple_mock.MockTimer(gtest_progress_reporter)
-
- def tearDown(self):
- self._mock_timer.Restore()
-
- def testTestSuiteWithWrapperSuite(self):
- suite = unittest.TestSuite()
- suite.addTest(unittest.TestSuite())
- self._formatter.StartTestSuite(suite)
- self._formatter.StopTestSuite(suite)
-
- self.assertEqual(self._stream.output_data, '')
-
- def testTestSuiteWithTestCase(self):
- suite = unittest.TestSuite()
- suite.addTest(TestFoo(methodName='runTezt'))
- self._formatter.StartTestSuite(suite)
- self._mock_timer.SetTime(0.042)
- self._formatter.StopTestSuite(suite)
-
- expected = ('[----------] 1 test\n'
- '[----------] 1 test (42 ms total)\n\n')
- self.assertEqual(self._stream.output_data, expected)
-
- def testCaseFailure(self):
- test = TestFoo(methodName='runTezt')
- self._formatter.StartTest(test)
- self._mock_timer.SetTime(0.042)
- self._formatter.Failure(test, INTENTIONAL_EXCEPTION)
-
- expected = (
- '[ RUN ] gtest_progress_reporter_unittest.TestFoo.runTezt\n'
- '[ FAILED ] gtest_progress_reporter_unittest.TestFoo.runTezt '
- '(42 ms)\n')
- self.assertEqual(self._stream.output_data, expected)
-
- def testCaseSuccess(self):
- test = TestFoo(methodName='runTezt')
- self._formatter.StartTest(test)
- self._mock_timer.SetTime(0.042)
- self._formatter.Success(test)
-
- expected = (
- '[ RUN ] gtest_progress_reporter_unittest.TestFoo.runTezt\n'
- '[ OK ] gtest_progress_reporter_unittest.TestFoo.runTezt '
- '(42 ms)\n')
- self.assertEqual(self._stream.output_data, expected)
-
- def testStopTestRun(self):
- result = TestResultWithSuccesses()
- self._formatter.StopTestRun(result)
-
- expected = '[ PASSED ] 0 tests.\n\n'
- self.assertEqual(self._stream.output_data, expected)
-
- def testStopTestRunWithFailureAndSuccess(self):
- test = TestFoo(methodName='runTezt')
- result = TestResultWithSuccesses()
- result.addSuccess(test)
- result.addFailure(test, INTENTIONAL_EXCEPTION)
- self._formatter.StopTestRun(result)
-
- expected = (
- '[ PASSED ] 1 test.\n'
- '[ FAILED ] 1 test, listed below:\n'
- '[ FAILED ] gtest_progress_reporter_unittest.TestFoo.runTezt\n\n'
- '1 FAILED TEST\n\n')
- self.assertEqual(self._stream.output_data, expected)
« no previous file with comments | « tools/telemetry/telemetry/testing/gtest_progress_reporter.py ('k') | tools/telemetry/telemetry/testing/internal/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698