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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/port/server_process_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 side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py
index c5f9ba61a5b5e8e0967cd9867268cce175dc209e..0a3e09144fd56db11658cfcdd3c0c7c58da4f9cd 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py
@@ -38,19 +38,21 @@ from webkitpy.common.system.outputcapture import OutputCapture
class TrivialMockPort(object):
+
def __init__(self):
self.host = MockSystemHost()
self.host.executive.kill_process = lambda x: None
self.host.executive.kill_process = lambda x: None
def results_directory(self):
- return "/mock-results"
+ return '/mock-results'
def process_kill_time(self):
return 1
class MockFile(object):
+
def __init__(self, server_process):
self._server_process = server_process
self.closed = False
@@ -67,6 +69,7 @@ class MockFile(object):
class MockProc(object):
+
def __init__(self, server_process):
self.stdin = MockFile(server_process)
self.stdout = MockFile(server_process)
@@ -81,6 +84,7 @@ class MockProc(object):
class FakeServerProcess(server_process.ServerProcess):
+
def _start(self):
self._proc = MockProc(self)
self.stdin = self._proc.stdin
@@ -91,8 +95,12 @@ class FakeServerProcess(server_process.ServerProcess):
class TestServerProcess(unittest.TestCase):
+
def test_basic(self):
- cmd = [sys.executable, '-c', 'import sys; import time; time.sleep(0.02); print "stdout"; sys.stdout.flush(); print >>sys.stderr, "stderr"']
+ cmd = [
+ sys.executable,
+ '-c',
+ 'import sys; import time; time.sleep(0.02); print "stdout"; sys.stdout.flush(); print >>sys.stderr, "stderr"']
host = SystemHost()
factory = PortFactory(host)
port = factory.get()
@@ -112,17 +120,17 @@ class TestServerProcess(unittest.TestCase):
# FIXME: https://bugs.webkit.org/show_bug.cgi?id=88280
line = proc.read_stdout_line(now + 1.0)
if line:
- self.assertEqual(line.strip(), "stdout")
+ self.assertEqual(line.strip(), 'stdout')
line = proc.read_stderr_line(now + 1.0)
if line:
- self.assertEqual(line.strip(), "stderr")
+ self.assertEqual(line.strip(), 'stderr')
proc.stop(0)
def test_cleanup(self):
port_obj = TrivialMockPort()
- server_process = FakeServerProcess(port_obj=port_obj, name="test", cmd=["test"])
+ server_process = FakeServerProcess(port_obj=port_obj, name='test', cmd=['test'])
server_process._start()
server_process.stop()
self.assertTrue(server_process.stdin.closed)
@@ -133,37 +141,38 @@ class TestServerProcess(unittest.TestCase):
port_obj = TrivialMockPort()
port_obj.host.platform.os_name = 'win'
- server_process = FakeServerProcess(port_obj=port_obj, name="test", cmd=["test"])
- server_process.write("should break")
+ server_process = FakeServerProcess(port_obj=port_obj, name='test', cmd=['test'])
+ server_process.write('should break')
self.assertTrue(server_process.has_crashed())
self.assertIsNotNone(server_process.pid())
self.assertIsNone(server_process._proc)
self.assertEqual(server_process.broken_pipes, [server_process.stdin])
port_obj.host.platform.os_name = 'mac'
- server_process = FakeServerProcess(port_obj=port_obj, name="test", cmd=["test"])
- server_process.write("should break")
+ server_process = FakeServerProcess(port_obj=port_obj, name='test', cmd=['test'])
+ server_process.write('should break')
self.assertTrue(server_process.has_crashed())
self.assertIsNone(server_process._proc)
self.assertEqual(server_process.broken_pipes, [server_process.stdin])
class TestQuoteData(unittest.TestCase):
+
def test_plain(self):
qd = server_process.quote_data
- self.assertEqual(qd("foo"), ["foo"])
+ self.assertEqual(qd('foo'), ['foo'])
def test_trailing_spaces(self):
qd = server_process.quote_data
- self.assertEqual(qd("foo "),
- ["foo\x20\x20"])
+ self.assertEqual(qd('foo '),
+ ['foo\x20\x20'])
def test_newlines(self):
qd = server_process.quote_data
- self.assertEqual(qd("foo \nbar\n"),
- ["foo\x20\\n", "bar\\n"])
+ self.assertEqual(qd('foo \nbar\n'),
+ ['foo\x20\\n', 'bar\\n'])
def test_binary_data(self):
qd = server_process.quote_data
- self.assertEqual(qd("\x00\x01ab"),
- ["\\x00\\x01ab"])
+ self.assertEqual(qd('\x00\x01ab'),
+ ['\\x00\\x01ab'])
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/server_process_mock.py ('k') | Tools/Scripts/webkitpy/layout_tests/port/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698