Added simple wrapping for waterfall display.
This is done by adding a whitespace before the last underscore on strings above length 25, which should only affect the _unittest and _integrationtest suffixes for our tests, that are the widest unwrappable strings in our waterfall display. I also removed all reduntant use of ShellCommand in favour for the AddCommonStep function (that wraps the description text). Also fixed so Mac tests are not halting the build. Cleaned up some code style formatting. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/400005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1735 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -7,34 +7,70 @@
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
"""Unit tests for helper functions in utils.py."""
|
||||
|
||||
__author__ = 'kjellander@webrtc.org (Henrik Kjellander)'
|
||||
|
||||
import unittest
|
||||
|
||||
from webrtc_buildbot import utils
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def testGetEnabledTests(self):
|
||||
tests = {
|
||||
# Test name Linux Mac Windows
|
||||
"test_1": (True, True, False),
|
||||
"test_2": (True, False, False),
|
||||
# Name Linux Mac Windows
|
||||
'test_1': (True, True, False),
|
||||
'test_2': (True, False, False),
|
||||
}
|
||||
result = utils.GetEnabledTests(tests, "Linux")
|
||||
result = utils.GetEnabledTests(tests, 'Linux')
|
||||
self.assertEqual(2, len(result))
|
||||
self.assertEqual('test_1', result[0])
|
||||
self.assertEqual('test_2', result[1])
|
||||
|
||||
result = utils.GetEnabledTests(tests, "Mac")
|
||||
result = utils.GetEnabledTests(tests, 'Mac')
|
||||
self.assertEqual(1, len(result))
|
||||
self.assertEqual('test_1', result[0])
|
||||
|
||||
result = utils.GetEnabledTests(tests, "Windows")
|
||||
result = utils.GetEnabledTests(tests, 'Windows')
|
||||
self.assertEqual(0, len(result))
|
||||
|
||||
self.assertRaises(utils.UnsupportedPlatformError,
|
||||
utils.GetEnabledTests, tests, "BeOS")
|
||||
utils.GetEnabledTests, tests, 'BeOS')
|
||||
|
||||
if __name__ == "__main__":
|
||||
def testEmptyListExitQuietly(self):
|
||||
factory = utils.WebRTCFactory()
|
||||
self.assertEqual([], factory._WrapLongLines([]))
|
||||
|
||||
def testShortLinesShallNotWrap(self):
|
||||
factory = utils.WebRTCFactory()
|
||||
self.assertEqual(['a'], factory._WrapLongLines(['a']))
|
||||
|
||||
string_25_len = '12345678901234567890123_5'
|
||||
result = factory._WrapLongLines([string_25_len, string_25_len])
|
||||
self.assertEqual(string_25_len, result[0])
|
||||
self.assertEqual(string_25_len, result[1])
|
||||
|
||||
def testLinesWithMoreThan25CharactersWithNoWrapCharacterIsUnchanged(self):
|
||||
factory = utils.WebRTCFactory()
|
||||
string_26_len = '12345678901234567890123456'
|
||||
result = factory._WrapLongLines([string_26_len, string_26_len])
|
||||
self.assertEqual(string_26_len, result[0])
|
||||
self.assertEqual(string_26_len, result[1])
|
||||
|
||||
def testLinesWithMoreThan25CharactersShallWrapOnWrapCharacter(self):
|
||||
factory = utils.WebRTCFactory()
|
||||
string_26_len = '123456789012345678901234_6'
|
||||
test_list = [string_26_len, string_26_len]
|
||||
result = factory._WrapLongLines(test_list)
|
||||
expected_result = '123456789012345678901234 _6'
|
||||
self.assertEqual(expected_result, result[0])
|
||||
self.assertEqual(expected_result, result[1])
|
||||
# Verify the original test_list was not modified too.
|
||||
self.assertEqual(string_26_len, test_list[0])
|
||||
self.assertEqual(string_26_len, test_list[1])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user