summaryrefslogtreecommitdiffstats
path: root/src/cephadm/tox.ini
blob: a6d7f3958372dee2b2d23b10f2d7ae9bf9bc03a6 (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
[tox]
envlist =
    py3
    mypy
    fix
    flake8
skipsdist = true

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

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

[testenv]
skip_install=true
deps =
  pyfakefs == 4.5.6 ; python_version < "3.7"
  pyfakefs >= 5, < 6 ; python_version >= "3.7"
  mock
  pytest
  pyyaml
commands=pytest {posargs}

[testenv:mypy]
basepython = python3
deps =
    mypy
    types-PyYAML
    -c{toxinidir}/../mypy-constrains.txt
commands = mypy --config-file ../mypy.ini {posargs:cephadm.py}

[testenv:fix]
basepython = python3
deps =
    autopep8
commands =
    python --version
    autopep8 {[autopep8]addopts} {posargs: cephadm.py}

[testenv:flake8]
basepython = python3
allowlist_externals = bash
deps =
    flake8 == 5.0.4
    flake8-quotes
commands =
    flake8 --config=tox.ini {posargs:cephadm.py}
    bash -c "test $(grep -c 'docker.io' cephadm.py) == 11"
# Downstream distributions may choose to alter this "docker.io" number,
# to make sure no new references to docker.io are creeping in unnoticed.

# coverage env is intentionally left out of the envlist. It is here for developers
# to run locally to generate and review test coverage of cephadm.
[testenv:coverage]
skip_install=true
deps =
  {[testenv]deps}
  pytest-cov
commands =
  pytest -v --cov=cephadm --cov-report=term-missing --cov-report=html {posargs}