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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/port/test.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/test.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/test.py b/Tools/Scripts/webkitpy/layout_tests/port/test.py
index 93841cf4573602027c0dedc369b695d6259b0346..40c6f2278e92aefc811cd4a4ddff2df33f69df99 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/test.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/test.py
@@ -42,9 +42,10 @@ from webkitpy.common.system.crashlogs import CrashLogs
# This sets basic expectations for a test. Each individual expectation
# can be overridden by a keyword argument in TestList.add().
class TestInstance(object):
+
def __init__(self, name):
self.name = name
- self.base = name[(name.rfind("/") + 1):name.rfind(".")]
+ self.base = name[(name.rfind('/') + 1):name.rfind('.')]
self.crash = False
self.web_process_crash = False
self.exception = False
@@ -75,6 +76,7 @@ class TestInstance(object):
# This is an in-memory list of tests, what we want them to produce, and
# what we want to claim are the expected results.
class TestList(object):
+
def __init__(self):
self.tests = {}
@@ -109,6 +111,7 @@ TOTAL_SKIPS = 29
UNEXPECTED_PASSES = 1
UNEXPECTED_FAILURES = 26
+
def unit_test_list():
tests = TestList()
tests.add('failures/expected/crash.html', crash=True)
@@ -140,11 +143,11 @@ def unit_test_list():
actual_checksum=None)
tests.add('failures/expected/missing_text.html', expected_text=None)
tests.add('failures/expected/newlines_leading.html',
- expected_text="\nfoo\n", actual_text="foo\n")
+ expected_text='\nfoo\n', actual_text='foo\n')
tests.add('failures/expected/newlines_trailing.html',
- expected_text="foo\n\n", actual_text="foo\n")
+ expected_text='foo\n\n', actual_text='foo\n')
tests.add('failures/expected/newlines_with_excess_CR.html',
- expected_text="foo\r\r\r\n", actual_text="foo\n")
+ expected_text='foo\r\r\r\n', actual_text='foo\n')
tests.add('failures/expected/text.html', actual_text='text_fail-png')
tests.add('failures/expected/crash_then_text.html')
tests.add('failures/expected/skip_text.html', actual_text='text diff')
@@ -162,9 +165,9 @@ layer at (0,0) size 800x34
""", expected_text=None)
tests.add('failures/unexpected/crash.html', crash=True)
tests.add('failures/unexpected/crash-with-stderr.html', crash=True,
- error="mock-std-error-output")
+ error='mock-std-error-output')
tests.add('failures/unexpected/web-process-crash-with-stderr.html', web_process_crash=True,
- error="mock-std-error-output")
+ error='mock-std-error-output')
tests.add('failures/unexpected/pass.html')
tests.add('failures/unexpected/text-checksum.html',
actual_text='text-checksum_fail-txt',
@@ -217,7 +220,11 @@ layer at (0,0) size 800x34
tests.add_reftest('passes/phpreftest.php', 'passes/phpreftest-expected-mismatch.svg', same_image=False)
tests.add_reftest('failures/expected/reftest.html', 'failures/expected/reftest-expected.html', same_image=False)
tests.add_reftest('failures/expected/mismatch.html', 'failures/expected/mismatch-expected-mismatch.html', same_image=True)
- tests.add_reftest('failures/unexpected/crash-reftest.html', 'failures/unexpected/crash-reftest-expected.html', same_image=True, crash=True)
+ tests.add_reftest(
+ 'failures/unexpected/crash-reftest.html',
+ 'failures/unexpected/crash-reftest-expected.html',
+ same_image=True,
+ crash=True)
tests.add_reftest('failures/unexpected/reftest.html', 'failures/unexpected/reftest-expected.html', same_image=False)
tests.add_reftest('failures/unexpected/mismatch.html', 'failures/unexpected/mismatch-expected-mismatch.html', same_image=True)
tests.add('failures/unexpected/reftest-nopixel.html', actual_checksum=None, actual_image=None, is_reftest=True)
@@ -253,11 +260,11 @@ layer at (0,0) size 800x34
# For testing --pixel-test-directories.
tests.add('failures/unexpected/pixeldir/image_in_pixeldir.html',
- actual_image='image_in_pixeldir-pngtEXtchecksum\x00checksum_fail',
- expected_image='image_in_pixeldir-pngtEXtchecksum\x00checksum-png')
+ actual_image='image_in_pixeldir-pngtEXtchecksum\x00checksum_fail',
+ expected_image='image_in_pixeldir-pngtEXtchecksum\x00checksum-png')
tests.add('failures/unexpected/image_not_in_pixeldir.html',
- actual_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum_fail',
- expected_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum-png')
+ actual_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum_fail',
+ expected_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum-png')
# For testing that virtual test suites don't expand names containing themselves
# See webkit.org/b/97925 and base_unittest.PortTest.test_tests().
@@ -370,11 +377,11 @@ class TestPort(Port):
)
FALLBACK_PATHS = {
- 'xp': ['test-win-win7', 'test-win-xp'],
- 'win7': ['test-win-win7'],
- 'leopard': ['test-mac-leopard', 'test-mac-snowleopard'],
+ 'xp': ['test-win-win7', 'test-win-xp'],
+ 'win7': ['test-win-win7'],
+ 'leopard': ['test-mac-leopard', 'test-mac-snowleopard'],
'snowleopard': ['test-mac-snowleopard'],
- 'lucid': ['test-linux-x86_64', 'test-win-win7'],
+ 'lucid': ['test-linux-x86_64', 'test-win-win7'],
}
@classmethod
@@ -450,7 +457,7 @@ class TestPort(Port):
if not actual_contents or not expected_contents:
return (True, None)
if diffed:
- return ("< %s\n---\n> %s\n" % (expected_contents, actual_contents), None)
+ return ('< %s\n---\n> %s\n' % (expected_contents, actual_contents), None)
return (None, None)
def layout_tests_dir(self):
@@ -504,7 +511,7 @@ class TestPort(Port):
pass
def path_to_apache(self):
- return "/usr/sbin/httpd"
+ return '/usr/sbin/httpd'
def path_to_apache_config_file(self):
return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'httpd.conf')
@@ -554,6 +561,7 @@ class TestPort(Port):
class TestDriver(Driver):
+
"""Test/Dummy implementation of the driver interface."""
next_pid = 1
@@ -564,7 +572,8 @@ class TestDriver(Driver):
def cmd_line(self, pixel_tests, per_test_args):
pixel_tests_flag = '-p' if pixel_tests else ''
- return [self._port._path_to_driver()] + [pixel_tests_flag] + self._port.get_option('additional_drt_flag', []) + per_test_args
+ return [self._port._path_to_driver()] + [pixel_tests_flag] + \
+ self._port.get_option('additional_drt_flag', []) + per_test_args
def run_test(self, driver_input, stop_when_done):
if not self.started:
@@ -637,10 +646,10 @@ class TestDriver(Driver):
else:
image = test.actual_image
return DriverOutput(actual_text, image, test.actual_checksum, audio,
- crash=(crash or web_process_crash), crashed_process_name=crashed_process_name,
- crashed_pid=crashed_pid, crash_log=crash_log,
- test_time=time.time() - start_time, timeout=test.timeout, error=test.error, pid=self.pid,
- leak=test.leak)
+ crash=(crash or web_process_crash), crashed_process_name=crashed_process_name,
+ crashed_pid=crashed_pid, crash_log=crash_log,
+ test_time=time.time() - start_time, timeout=test.timeout, error=test.error, pid=self.pid,
+ leak=test.leak)
def stop(self):
self.started = False
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py ('k') | Tools/Scripts/webkitpy/layout_tests/port/win.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698