Update yapf version
Add local .style.yapf file containing the local style
R=binji@chromium.org
Review URL: https://codereview.chromium.org/1128053005
diff --git a/.style.yapf b/.style.yapf
new file mode 100644
index 0000000..e0f95a6
--- /dev/null
+++ b/.style.yapf
@@ -0,0 +1,3 @@
+[style]
+split_before_named_assigns = False
+based_on_style = chromium
diff --git a/chrome_test/__init__.py b/chrome_test/__init__.py
index 8671e03..bd21e43 100644
--- a/chrome_test/__init__.py
+++ b/chrome_test/__init__.py
@@ -1,7 +1,6 @@
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Test harness for testing chrome apps / extensions."""
import argparse
@@ -28,7 +27,6 @@
import httpd
import naclports
-
# Pinned chrome revision. Update this to pull in a new chrome.
# Try to select a version that exists on all platforms.
CHROME_REVISION = '311001'
@@ -40,7 +38,7 @@
TESTING_LIB = os.path.join(SCRIPT_DIR, 'chrome_test.js')
TESTING_EXTENSION = os.path.join(SCRIPT_DIR, 'extension')
-TESTING_TCP_APP = os.path.join(SCRIPT_DIR, 'tcpapp');
+TESTING_TCP_APP = os.path.join(SCRIPT_DIR, 'tcpapp')
RETURNCODE_KILL = -9
@@ -217,7 +215,7 @@
# to invoke taskkill.
subprocess.call(
[os.path.join(os.environ['SYSTEMROOT'], 'System32', 'taskkill.exe'),
- '/F', '/T', '/PID', str(proc.pid)])
+ '/F', '/T', '/PID', str(proc.pid)])
else:
# Send SIGKILL=9 to the entire process group associated with the child.
os.kill(-proc.pid, 9)
@@ -236,6 +234,7 @@
timeout = None
result = []
+
def Target():
result.append(list(proc.communicate()))
@@ -340,7 +339,7 @@
return
# Allow the tests to request the current test filter string.
elif ('filter' in params and len(params['filter']) == 1 and
- params['filter'][0] == '1'):
+ params['filter'][0] == '1'):
self.send_response(200, 'OK')
self.send_header('Content-type', 'text/html')
self.send_header('Content-length', str(len(self.server.filter_string)))
@@ -452,8 +451,7 @@
# Ensure all extension / app paths are absolute.
load_extensions = [os.path.abspath(os.path.expanduser(i))
for i in load_extensions]
- load_apps = [os.path.abspath(os.path.expanduser(i))
- for i in load_apps]
+ load_apps = [os.path.abspath(os.path.expanduser(i)) for i in load_apps]
# Add in the chrome_test extension and compute its id.
load_extensions += [TESTING_EXTENSION, TESTING_TCP_APP]
@@ -484,8 +482,8 @@
cmd = []
if sys.platform.startswith('linux') and use_xvfb:
- cmd += ['xvfb-run', '--auto-servernum',
- '-s', '-screen 0 1024x768x24 -ac']
+ cmd += ['xvfb-run', '--auto-servernum', '-s',
+ '-screen 0 1024x768x24 -ac']
cmd += [chrome_path]
cmd += ['--user-data-dir=' + work_dir]
# We want to pin the pnacl component to the one that we downloaded.
@@ -516,9 +514,8 @@
# be certain we bring down Chrome on a timeout.
os.setpgid(0, 0)
- p = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
- preexec_fn=ProcessGroup)
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT, preexec_fn=ProcessGroup)
logging.info('Started chrome with command line: %s' % (' '.join(cmd)))
stdout, _, returncode = CommunicateWithTimeout(p, timeout=timeout)
if logging.getLogger().isEnabledFor(logging.DEBUG):
@@ -542,19 +539,21 @@
if returncode == RETURNCODE_KILL:
print '[ TIMEOUT ] Timed out, ran %d tests, %d failed.' % (
- len(s.tests), len(s.failed_tests))
+ len(s.tests), len(s.failed_tests)
+ )
sys.exit(1)
elif s.expected_test_count is None:
- print ('[ XXXXXXXX ] Expected test count never emitted.')
+ print('[ XXXXXXXX ] Expected test count never emitted.')
sys.exit(1)
elif s.test_results != s.expected_test_count:
- print ('[ XXXXXXXX ] '
- 'Expected %d tests, but only %d had results, with %d failures.' % (
- s.expected_test_count, s.test_results, len(s.failed_tests)))
+ print('[ XXXXXXXX ] '
+ 'Expected %d tests, but only %d had results, with %d failures.' % (
+ s.expected_test_count, s.test_results, len(s.failed_tests)
+ ))
sys.exit(1)
elif s.result != 0:
- print '[ Failures ] Ran %d tests, %d failed.' % (
- len(s.tests), len(s.failed_tests))
+ print '[ Failures ] Ran %d tests, %d failed.' % (len(s.tests),
+ len(s.failed_tests))
sys.exit(1)
else:
print '[ Success! ] Ran %d tests.' % len(s.tests)
@@ -568,42 +567,29 @@
NOTE: Ends the process with sys.exit(1) on failure.
"""
parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument(
- 'start_path', metavar='START_PATH',
- help='location in which to run tests')
- parser.add_argument(
- '-x', '--xvfb', action='store_true',
- help='Run Chrome thru xvfb on Linux.')
- parser.add_argument(
- '-a', '--arch', default='x86_64',
- help='Chrome architecture: i686 / x86_64.')
- parser.add_argument(
- '-v', '--verbose', default=0, action='count',
- help='Emit verbose output, use twice for more.')
- parser.add_argument(
- '-t', '--timeout', default=30, type=float,
- help='Timeout for all tests (in seconds).')
- parser.add_argument(
- '-C', '--chdir', default=[], action='append',
- help='Add a root directory.')
- parser.add_argument(
- '--load-extension', default=[], action='append',
- help='Add an extension to load on start.')
- parser.add_argument(
- '--load-and-launch-app', default=[], action='append',
- help='Add an app to load on start.')
- parser.add_argument(
- '--unlimited-storage', default=False, action='store_true',
- help='Allow unlimited storage.')
- parser.add_argument(
- '--enable-nacl', default=False, action='store_true',
- help='Enable NaCl generally.')
- parser.add_argument(
- '--enable-nacl-debug', default=False, action='store_true',
- help='Enable NaCl debugging.')
- parser.add_argument(
- '-f', '--filter', default='*',
- help='Filter on tests.')
+ parser.add_argument('start_path', metavar='START_PATH',
+ help='location in which to run tests')
+ parser.add_argument('-x', '--xvfb', action='store_true',
+ help='Run Chrome thru xvfb on Linux.')
+ parser.add_argument('-a', '--arch', default='x86_64',
+ help='Chrome architecture: i686 / x86_64.')
+ parser.add_argument('-v', '--verbose', default=0, action='count',
+ help='Emit verbose output, use twice for more.')
+ parser.add_argument('-t', '--timeout', default=30, type=float,
+ help='Timeout for all tests (in seconds).')
+ parser.add_argument('-C', '--chdir', default=[], action='append',
+ help='Add a root directory.')
+ parser.add_argument('--load-extension', default=[], action='append',
+ help='Add an extension to load on start.')
+ parser.add_argument('--load-and-launch-app', default=[], action='append',
+ help='Add an app to load on start.')
+ parser.add_argument('--unlimited-storage', default=False, action='store_true',
+ help='Allow unlimited storage.')
+ parser.add_argument('--enable-nacl', default=False, action='store_true',
+ help='Enable NaCl generally.')
+ parser.add_argument('--enable-nacl-debug', default=False, action='store_true',
+ help='Enable NaCl debugging.')
+ parser.add_argument('-f', '--filter', default='*', help='Filter on tests.')
parser.add_argument(
'-p', '--param', default=[], action='append',
help='Add a parameter to the end of the url, = separated.')
@@ -623,9 +609,8 @@
logging.getLogger().setLevel(logging.INFO)
else:
logging.getLogger().setLevel(logging.WARNING)
- logging.basicConfig(
- format='%(asctime)-15s %(levelname)s: %(message)s',
- datefmt='%Y-%m-%d %H:%M:%S')
+ logging.basicConfig(format='%(asctime)-15s %(levelname)s: %(message)s',
+ datefmt='%Y-%m-%d %H:%M:%S')
if not options.chdir:
options.chdir.append('.')
diff --git a/lib/naclports/tests/test_package_index.py b/lib/naclports/tests/test_package_index.py
index 7f252d8..e5fc31b 100644
--- a/lib/naclports/tests/test_package_index.py
+++ b/lib/naclports/tests/test_package_index.py
@@ -73,8 +73,8 @@
config_release = Configuration('arm', 'newlib', False)
self.assertFalse(index.Contains('foo', config_release))
index.packages[('foo', config_release)] = {
- 'NAME': 'dummy',
- 'BUILD_SDK_VERSION': 123
+ 'NAME': 'dummy',
+ 'BUILD_SDK_VERSION': 123
}
with patch('naclports.util.GetSDKVersion') as mock_version:
# Setting the mock SDK version to 123 should mean that the
diff --git a/ports/devenv/devenv_large_test.py b/ports/devenv/devenv_large_test.py
index bb8e99f..1b69fbe 100755
--- a/ports/devenv/devenv_large_test.py
+++ b/ports/devenv/devenv_large_test.py
@@ -2,7 +2,6 @@
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Large tests of the devenv app."""
import os
diff --git a/ports/devenv/devenv_small_test.py b/ports/devenv/devenv_small_test.py
index 1e2de87..0667b07 100755
--- a/ports/devenv/devenv_small_test.py
+++ b/ports/devenv/devenv_small_test.py
@@ -2,7 +2,6 @@
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Tests of the devenv app."""
import os
diff --git a/ports/devenv/io2014_test.py b/ports/devenv/io2014_test.py
index 0ddcaa5..7ccb9d2 100755
--- a/ports/devenv/io2014_test.py
+++ b/ports/devenv/io2014_test.py
@@ -2,7 +2,6 @@
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Test of Google I/O 2014 tutorial."""
import os
diff --git a/ports/devenv/jseval_test.py b/ports/devenv/jseval_test.py
index b692fcf..14e0960 100755
--- a/ports/devenv/jseval_test.py
+++ b/ports/devenv/jseval_test.py
@@ -2,7 +2,6 @@
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""Tests of the jseval utility."""
import os
diff --git a/requirements.txt b/requirements.txt
index 6c0c4c5..6f25e71 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,4 +6,4 @@
pylint==1.4.0
rednose==0.4.1
termcolor==1.1.0
-yapf==0.1.4
+yapf==0.1.8