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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/port/port_testcase.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 side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
index 3fa4829dab7a42895c110c34261fe82fe9098e69..16fd70a37e623b466861b15d206b98e4e6e7273e 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -48,7 +48,7 @@ from webkitpy.tool.mocktool import MockOptions
# FIXME: get rid of this fixture
class TestWebKitPort(Port):
- port_name = "testwebkitport"
+ port_name = 'testwebkitport'
def __init__(self, port_name=None, symbols_string=None,
expectations_file=None, skips_file=None, host=None, config=None,
@@ -65,10 +65,11 @@ class TestWebKitPort(Port):
return self.symbols_string
def _tests_for_disabled_features(self):
- return ["accessibility", ]
+ return ['accessibility', ]
class FakePrinter(object):
+
def write_update(self, msg):
pass
@@ -76,8 +77,8 @@ class FakePrinter(object):
pass
-
class PortTestCase(unittest.TestCase):
+
"""Tests that all Port implementations must pass."""
HTTP_PORTS = (8000, 8080, 8443)
WEBSOCKET_PORTS = (8880,)
@@ -123,7 +124,7 @@ class PortTestCase(unittest.TestCase):
try:
oc.capture_output()
self.assertEqual(port.check_build(needs_http=True, printer=FakePrinter()),
- test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
+ test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
finally:
out, err, logs = oc.restore_output()
self.assertIn('pretty patches', logs) # And, hereere we should get warnings about both.
@@ -159,7 +160,7 @@ class PortTestCase(unittest.TestCase):
test_socket = socket.socket()
test_socket.connect((host, port))
self.fail()
- except IOError, e:
+ except IOError as e:
self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET))
finally:
test_socket.close()
@@ -169,7 +170,7 @@ class PortTestCase(unittest.TestCase):
try:
test_socket = socket.socket()
test_socket.connect((host, port))
- except IOError, e:
+ except IOError as e:
self.fail('failed to connect to %s:%d' % (host, port))
finally:
test_socket.close()
@@ -194,12 +195,12 @@ class PortTestCase(unittest.TestCase):
def test_diff_image(self):
def _path_to_image_diff():
- return "/path/to/image_diff"
+ return '/path/to/image_diff'
port = self.make_port()
port._path_to_image_diff = _path_to_image_diff
- mock_image_diff = "MOCK Image Diff"
+ mock_image_diff = 'MOCK Image Diff'
def mock_run_command(args):
port._filesystem.write_binary_file(args[4], mock_image_diff)
@@ -207,25 +208,30 @@ class PortTestCase(unittest.TestCase):
# Images are different.
port._executive = MockExecutive2(run_command_fn=mock_run_command)
- self.assertEqual(mock_image_diff, port.diff_image("EXPECTED", "ACTUAL")[0])
+ self.assertEqual(mock_image_diff, port.diff_image('EXPECTED', 'ACTUAL')[0])
# Images are the same.
port._executive = MockExecutive2(exit_code=0)
- self.assertEqual(None, port.diff_image("EXPECTED", "ACTUAL")[0])
+ self.assertEqual(None, port.diff_image('EXPECTED', 'ACTUAL')[0])
# There was some error running image_diff.
port._executive = MockExecutive2(exit_code=2)
exception_raised = False
try:
- port.diff_image("EXPECTED", "ACTUAL")
- except ValueError, e:
+ port.diff_image('EXPECTED', 'ACTUAL')
+ except ValueError as e:
exception_raised = True
self.assertFalse(exception_raised)
def test_diff_image_crashed(self):
port = self.make_port()
port._executive = MockExecutive2(exit_code=2)
- self.assertEqual(port.diff_image("EXPECTED", "ACTUAL"), (None, 'Image diff returned an exit code of 2. See http://crbug.com/278596'))
+ self.assertEqual(
+ port.diff_image(
+ 'EXPECTED',
+ 'ACTUAL'),
+ (None,
+ 'Image diff returned an exit code of 2. See http://crbug.com/278596'))
def test_check_wdiff(self):
port = self.make_port()
@@ -241,7 +247,7 @@ class PortTestCase(unittest.TestCase):
# error text, and also mark wdiff as not available.
self.make_wdiff_available(port)
self.assertTrue(port.wdiff_available())
- diff_txt = port.wdiff_text("/tmp/foo.html", "/tmp/bar.html")
+ diff_txt = port.wdiff_text('/tmp/foo.html', '/tmp/bar.html')
self.assertEqual(diff_txt, port._wdiff_error_html)
self.assertFalse(port.wdiff_available())
@@ -284,33 +290,34 @@ class PortTestCase(unittest.TestCase):
TestConfiguration('icecreamsandwich', 'x86', 'debug'),
TestConfiguration('icecreamsandwich', 'x86', 'release'),
]))
+
def test_get_crash_log(self):
port = self.make_port()
self.assertEqual(port._get_crash_log(None, None, None, None, newer_than=None),
- (None,
- 'crash log for <unknown process name> (pid <unknown>):\n'
- 'STDOUT: <empty>\n'
- 'STDERR: <empty>\n'))
+ (None,
+ 'crash log for <unknown process name> (pid <unknown>):\n'
+ 'STDOUT: <empty>\n'
+ 'STDERR: <empty>\n'))
self.assertEqual(port._get_crash_log('foo', 1234, 'out bar\nout baz', 'err bar\nerr baz\n', newer_than=None),
- ('err bar\nerr baz\n',
- 'crash log for foo (pid 1234):\n'
- 'STDOUT: out bar\n'
- 'STDOUT: out baz\n'
- 'STDERR: err bar\n'
- 'STDERR: err baz\n'))
+ ('err bar\nerr baz\n',
+ 'crash log for foo (pid 1234):\n'
+ 'STDOUT: out bar\n'
+ 'STDOUT: out baz\n'
+ 'STDERR: err bar\n'
+ 'STDERR: err baz\n'))
self.assertEqual(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=None),
- ('foo\xa6bar',
- u'crash log for foo (pid 1234):\n'
- u'STDOUT: foo\ufffdbar\n'
- u'STDERR: foo\ufffdbar\n'))
+ ('foo\xa6bar',
+ u'crash log for foo (pid 1234):\n'
+ u'STDOUT: foo\ufffdbar\n'
+ u'STDERR: foo\ufffdbar\n'))
self.assertEqual(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=1.0),
- ('foo\xa6bar',
- u'crash log for foo (pid 1234):\n'
- u'STDOUT: foo\ufffdbar\n'
- u'STDERR: foo\ufffdbar\n'))
+ ('foo\xa6bar',
+ u'crash log for foo (pid 1234):\n'
+ u'STDOUT: foo\ufffdbar\n'
+ u'STDERR: foo\ufffdbar\n'))
def assert_build_path(self, options, dirs, expected_path):
port = self.make_port(options=options)
@@ -383,13 +390,16 @@ class PortTestCase(unittest.TestCase):
def test_skipped_directories_for_symbols(self):
# This first test confirms that the commonly found symbols result in the expected skipped directories.
- symbols_string = " ".join(["fooSymbol"])
+ symbols_string = ' '.join(['fooSymbol'])
expected_directories = set([
- "webaudio/codec-tests/mp3",
- "webaudio/codec-tests/aac",
+ 'webaudio/codec-tests/mp3',
+ 'webaudio/codec-tests/aac',
])
- result_directories = set(TestWebKitPort(symbols_string=symbols_string)._skipped_tests_for_unsupported_features(test_list=['webaudio/codec-tests/mp3/foo.html']))
+ result_directories = set(
+ TestWebKitPort(
+ symbols_string=symbols_string)._skipped_tests_for_unsupported_features(
+ test_list=['webaudio/codec-tests/mp3/foo.html']))
self.assertEqual(result_directories, expected_directories)
# Test that the nm string parsing actually works:
@@ -400,9 +410,12 @@ class PortTestCase(unittest.TestCase):
"""
# Note 'compositing' is not in the list of skipped directories (hence the parsing of GraphicsLayer worked):
expected_directories = set([
- "webaudio/codec-tests/aac",
+ 'webaudio/codec-tests/aac',
])
- result_directories = set(TestWebKitPort(symbols_string=symbols_string)._skipped_tests_for_unsupported_features(test_list=['webaudio/codec-tests/mp3/foo.html']))
+ result_directories = set(
+ TestWebKitPort(
+ symbols_string=symbols_string)._skipped_tests_for_unsupported_features(
+ test_list=['webaudio/codec-tests/mp3/foo.html']))
self.assertEqual(result_directories, expected_directories)
def _assert_config_file_for_platform(self, port, platform, config_file):
@@ -438,7 +451,8 @@ class PortTestCase(unittest.TestCase):
self._assert_config_file_for_platform(port, 'linux2', 'debian-httpd-2.2.conf')
self._assert_config_file_for_platform(port, 'mac', 'apache2-httpd.conf')
- self._assert_config_file_for_platform(port, 'win32', 'apache2-httpd.conf') # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports all use cygwin.
+ # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports all use cygwin.
+ self._assert_config_file_for_platform(port, 'win32', 'apache2-httpd.conf')
self._assert_config_file_for_platform(port, 'barf', 'apache2-httpd.conf')
def test_path_to_apache_config_file(self):

Powered by Google App Engine
This is Rietveld 408576698