From: Volker Theile Date: Wed, 29 Jul 2020 10:13:01 +0000 (+0200) Subject: mgr/cephadm: Introduce tox and autopep8 X-Git-Tag: v16.1.0~1542^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F36348%2Fhead;p=ceph.git mgr/cephadm: Introduce tox and autopep8 This PR introduces tox and autopep8 to format the Python code according to PEP8. It does NOT include any lint related things. Signed-off-by: Volker Theile --- diff --git a/src/pybind/mgr/requirements-fix.txt b/src/pybind/mgr/requirements-fix.txt new file mode 100644 index 0000000000000..caaefd789ec55 --- /dev/null +++ b/src/pybind/mgr/requirements-fix.txt @@ -0,0 +1 @@ +autopep8; python_version >= '3' diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 7ff959eefe47a..b4541d7c226bc 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -1,8 +1,30 @@ [tox] -envlist = py3, mypy +envlist = + py3, + mypy, + test, + fix skipsdist = true requires = cython +[flake8] +max-line-length = 100 +exclude = + .tox, + .vagrant, + __pycache__, + *.pyc, + templates, + .eggs + +[autopep8] +addopts = + --max-line-length {[flake8]max-line-length} + --exclude "{[flake8]exclude}" + --in-place + --recursive + --ignore-local-config + [testenv] setenv = UNITTEST = true @@ -27,7 +49,8 @@ deps = cython -rrequirements.txt mypy==0.782 -commands = mypy --config-file=../../mypy.ini \ +commands = + mypy --config-file=../../mypy.ini \ cephadm/module.py \ mgr_module.py \ dashboard/module.py \ @@ -38,3 +61,16 @@ commands = mypy --config-file=../../mypy.ini \ rook/module.py \ test_orchestrator/module.py \ volumes/__init__.py + +[testenv:test] +setenv = {[testenv]setenv} +deps = {[testenv]deps} +commands = {[testenv]commands} + +[testenv:fix] +basepython = python3 +deps = -rrequirements-fix.txt +commands = + python --version + autopep8 {[autopep8]addopts} {posargs: \ + cephadm/}