summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/tox.ini
blob: c97992113d542156424e41adee0737e631c6c18a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
[tox]
envlist =
    py3,
    py37,
    lint,
    mypy,
    test,
    fix
    flake8
    jinjalint
skipsdist = true

[pytest]
log_level=NOTSET

[base]
deps =
    -rrequirements.txt

[pylint]
# Allow similarity/code duplication detection
jobs = 1
addopts = -rn --rcfile=.pylintrc --jobs={[pylint]jobs}

[flake8]
max-line-length = 100
ignore =
    E501,
    W503,
exclude =
    .tox \
    .vagrant \
    __pycache__ \
    *.pyc \
    templates \
    .eggs
statistics = True

[autopep8]
addopts =
    --max-line-length {[flake8]max-line-length} \
    --exclude "{[flake8]exclude}" \
    --in-place \
    --recursive \
    --ignore-local-config

[testenv]
setenv =
    UNITTEST = true
    PYTHONPATH = $PYTHONPATH:..
deps =
    -rrequirements.txt
commands =
    pytest --doctest-modules {posargs: \
        mgr_util.py \
        tests/ \
        cephadm/ \
        mds_autoscaler/ \
        nfs/ \
        orchestrator/ \
        insights/ \
        pg_autoscaler/ \
        progress/ \
        snap_schedule}

[testenv:mypy]
setenv =
    MYPYPATH = {toxinidir}/..
passenv =
    MYPYPATH
basepython = python3
deps =
    -rrequirements.txt
    mypy==0.790
commands =
    mypy --config-file=../../mypy.ini \
           -m cephadm \
           -m dashboard \
           -m devicehealth \
           -m mds_autoscaler \
           -m mgr_module \
           -m mgr_util \
           -m mirroring \
           -m nfs \
           -m orchestrator \
           -m pg_autoscaler \
           -m progress \
           -m prometheus \
           -m rook \
           -m snap_schedule \
           -m stats \
           -m test_orchestrator \
           -m volumes

[testenv:test]
setenv = {[testenv]setenv}
deps = {[testenv]deps}
commands = {[testenv]commands}

[testenv:fix]
basepython = python3
deps =
    autopep8
    cli_api
commands =
    python --version
    autopep8 {[autopep8]addopts} {posargs: \
        cephadm/ orchestrator/ nfs/}

[testenv:pylint]
basepython = python3
deps =
    pylint
modules =
    cli_api
commands =
    pylint {[pylint]addopts} {posargs:{[testenv:pylint]modules}}

[testenv:flake8]
basepython = python3
deps =
    flake8
allowlist_externals = bash
modules =
    cephadm \
    cli_api \
    nfs \
    orchestrator \
    prometheus
commands =
    flake8 --config=tox.ini {posargs} \
      {posargs:{[testenv:flake8]modules}}
    bash -c 'test $(git ls-files cephadm | grep ".py$" | grep -v tests | xargs grep "docker.io" | wc -l) == 13'

[testenv:jinjalint]
basepython = python3
deps =
    jinjaninja
commands =
    jinja-ninja cephadm/templates