This patch add a new test using "autopep8" to keep codes reformatted
easily by using Python tool.

Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com>
---
 .travis.yml         |  1 +
 CONTRIBUTING.rst    | 13 +++++++++----
 tools/test-requires |  1 +
 tox.ini             | 14 +++++++++++++-
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 6c6e7f4..c6ef260 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@ env:
   - TOX_ENV=py35
   - TOX_ENV=pypy26
   - TOX_ENV=pycodestyle
+  - TOX_ENV=autopep8
 
 services:
   - docker
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index c98c79b..1138750 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -20,19 +20,24 @@ style.
   # You can send patches by "git send-email" command
   $ git send-email --to="ryu-devel@lists.sourceforge.net" *.patch
 
-Please check your changes with pycodestyle(pep8) and run unittests to make sure
-that they don't break the existing features. The following command
-does both for you.
+Please check your changes with autopep8, pycodestyle(pep8) and running
+unit tests to make sure that they don't break the existing features.
+The following command does all for you.
 
 .. code-block:: bash
 
   # Install dependencies of tests
   $ pip install -r tools/test-requires
 
+  # Execute autopep8
+  # Also, it is convenient to add settings of your editor or IDE for
+  # applying autopep8 automatically.
+  $ autopep8 --recursive --in-place ryu/
+
   # Execute unit tests and pycodestyle(pep8)
   $ ./run_tests.sh
 
-Of course, you are encouraged to add unittests when you add new
+Of course, you are encouraged to add unit tests when you add new
 features (it's not a must though).
 
 Python version and libraries
diff --git a/tools/test-requires b/tools/test-requires
index dd90cb5..e050338 100644
--- a/tools/test-requires
+++ b/tools/test-requires
@@ -1,3 +1,4 @@
+autopep8
 coverage
 mock
 nose
diff --git a/tox.ini b/tox.ini
index 33b287d..758d166 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py27,py34,py35,pypy26,pycodestyle
+envlist = py27,py34,py35,pypy26,pycodestyle,autopep8
 
 [testenv]
 deps =
@@ -38,6 +38,18 @@ deps =
 commands =
   pycodestyle
 
+[testenv:autopep8]
+# If some errors displayed with this test, please reformat codes with the
+# following command first.
+# $ autopep8 --recursive --in-place ryu/
+whitelist_externals=bash
+deps =
+  -U
+  --no-cache-dir
+  autopep8
+commands =
+  bash -c 'test -z "$(autopep8 --recursive --diff ryu/)"'
+
 [pycodestyle]
 exclude = pbr-*,.venv,.tox,.git,doc,dist,tools,vcsversion.py,.pyc,ryu/contrib
 # W503: line break occurred before a binary operator
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to