travis: Introduce autopep8 test
This patch add a new test using "autopep8" to keep codes reformatted easily by using Python tool. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:

committed by
FUJITA Tomonori

parent
d64db265b3
commit
83650576e4
@@ -8,6 +8,7 @@ env:
|
|||||||
- TOX_ENV=py35
|
- TOX_ENV=py35
|
||||||
- TOX_ENV=pypy26
|
- TOX_ENV=pypy26
|
||||||
- TOX_ENV=pycodestyle
|
- TOX_ENV=pycodestyle
|
||||||
|
- TOX_ENV=autopep8
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
@@ -20,19 +20,24 @@ style.
|
|||||||
# You can send patches by "git send-email" command
|
# You can send patches by "git send-email" command
|
||||||
$ git send-email --to="ryu-devel@lists.sourceforge.net" *.patch
|
$ git send-email --to="ryu-devel@lists.sourceforge.net" *.patch
|
||||||
|
|
||||||
Please check your changes with pycodestyle(pep8) and run unittests to make sure
|
Please check your changes with autopep8, pycodestyle(pep8) and running
|
||||||
that they don't break the existing features. The following command
|
unit tests to make sure that they don't break the existing features.
|
||||||
does both for you.
|
The following command does all for you.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Install dependencies of tests
|
# Install dependencies of tests
|
||||||
$ pip install -r tools/test-requires
|
$ 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)
|
# Execute unit tests and pycodestyle(pep8)
|
||||||
$ ./run_tests.sh
|
$ ./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).
|
features (it's not a must though).
|
||||||
|
|
||||||
Python version and libraries
|
Python version and libraries
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
autopep8
|
||||||
coverage
|
coverage
|
||||||
mock
|
mock
|
||||||
nose
|
nose
|
||||||
|
14
tox.ini
14
tox.ini
@@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py27,py34,py35,pypy26,pycodestyle
|
envlist = py27,py34,py35,pypy26,pycodestyle,autopep8
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
@@ -38,6 +38,18 @@ deps =
|
|||||||
commands =
|
commands =
|
||||||
pycodestyle
|
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]
|
[pycodestyle]
|
||||||
exclude = pbr-*,.venv,.tox,.git,doc,dist,tools,vcsversion.py,.pyc,ryu/contrib
|
exclude = pbr-*,.venv,.tox,.git,doc,dist,tools,vcsversion.py,.pyc,ryu/contrib
|
||||||
# W503: line break occurred before a binary operator
|
# W503: line break occurred before a binary operator
|
||||||
|
Reference in New Issue
Block a user