]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: Introduce tox and autopep8
authorVolker Theile <vtheile@suse.com>
Wed, 29 Jul 2020 10:13:01 +0000 (12:13 +0200)
committerVolker Theile <vtheile@suse.com>
Fri, 31 Jul 2020 12:35:09 +0000 (14:35 +0200)
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 <vtheile@suse.com>
src/pybind/mgr/requirements-fix.txt [new file with mode: 0644]
src/pybind/mgr/tox.ini

diff --git a/src/pybind/mgr/requirements-fix.txt b/src/pybind/mgr/requirements-fix.txt
new file mode 100644 (file)
index 0000000..caaefd7
--- /dev/null
@@ -0,0 +1 @@
+autopep8; python_version >= '3'
index 7ff959eefe47aaeba88c0d34ffb28169f5d758d0..b4541d7c226bcdfd75ca22ff76dce0ef96e50674 100644 (file)
@@ -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/}