Add style check and fix a few styling errors.
diff --git a/mysos/scheduler/http.py b/mysos/scheduler/http.py
index ec9a5ea..1a80b94 100644
--- a/mysos/scheduler/http.py
+++ b/mysos/scheduler/http.py
@@ -44,7 +44,6 @@
except ValueError as e:
raise bottle.HTTPResponse(e.message, status=400)
-
@route('/clusters/<clustername>', method=['DELETE'])
def remove(self, clustername):
"""Remove a db cluster."""
diff --git a/mysos/scheduler/mysos_scheduler.py b/mysos/scheduler/mysos_scheduler.py
index f174b31..558e72d 100644
--- a/mysos/scheduler/mysos_scheduler.py
+++ b/mysos/scheduler/mysos_scheduler.py
@@ -281,8 +281,8 @@
try:
# Wait for the scheduler to stop.
- # The use of 'stopped' event instead of scheduler_driver.join() is necessary to stop the process
- # with SIGINT.
+ # The use of 'stopped' event instead of scheduler_driver.join() is necessary to stop the
+ # process with SIGINT.
while not scheduler.stopped.wait(timeout=0.5):
pass
except KeyboardInterrupt:
diff --git a/mysos/testing/mysos_test_client.py b/mysos/testing/mysos_test_client.py
index 00733e8..42f3bc7 100755
--- a/mysos/testing/mysos_test_client.py
+++ b/mysos/testing/mysos_test_client.py
@@ -102,7 +102,10 @@
master_endpoint = wait_for_master(result['cluster_url']).service_endpoint
connection_str = "mysql://%s:%s@%s:%d/" % (
- options.cluster_user, result["cluster_password"], master_endpoint.host, master_endpoint.port)
+ options.cluster_user,
+ result["cluster_password"],
+ master_endpoint.host,
+ master_endpoint.port)
log.info("Connecting to the MySQL cluster master: %s" % connection_str)
engine = create_engine(connection_str)
diff --git a/tests/common/test_cluster.py b/tests/common/test_cluster.py
index 4179c47..23d1e80 100644
--- a/tests/common/test_cluster.py
+++ b/tests/common/test_cluster.py
@@ -10,6 +10,7 @@
from zake.fake_client import FakeClient
from zake.fake_storage import FakeStorage
+
class CallbackHandler(object):
"""Utility for testing callbacks."""
@@ -198,7 +199,7 @@
manager.promote_member(member1)
- with pytest.raises(ClusterManager.Error) as e:
+ with pytest.raises(ClusterManager.Error):
manager.delete_cluster()
manager.remove_member(member1)
diff --git a/tox.ini b/tox.ini
index 14ad2d2..9ead71f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,3 +6,13 @@
install_command = pip install -e .[test] --find-links {toxinidir}/3rdparty {opts} {packages}
# TODO(xujyan): Fix up 'test_scheduler_runs'.
commands = py.test -v -k 'not test_scheduler_runs' tests {posargs:}
+
+[testenv:style]
+deps =
+ twitter.common.app==0.3.0
+ twitter.common.collections==0.3.0
+ twitter.common.lang==0.3.0
+ twitter.common.log==0.3.0
+ twitter.checkstyle==0.1.0
+skip_install = True
+commands = twitterstyle -n ImportOrder mysos tests