summaryrefslogtreecommitdiffstats
path: root/src/cephadm/tox.ini
blob: b999a0f552b321e974b88cb60a3667f6fdb2aeed (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
[tox]
envlist =
    flake8
    mypy
    check-black
    py3
skipsdist = true
# REMINDER: run `tox -e format-black` to apply black formatting
# with the exact same specs as `check-black` expects.

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

[testenv]
setenv =
    PYTHONPATH = $PYTHONPATH:..:{toxinidir}/../python-common
passenv =
    PYTHONPATH
skip_install=true
deps =
  -rzipapp-reqs.txt
  pyfakefs == 4.5.6 ; python_version < "3.7"
  pyfakefs == 5.3.5 ; python_version >= "3.7"
  mock
  pytest
  pyyaml
commands=pytest {posargs}

[testenv:mypy]
setenv =
    MYPYPATH = {toxinidir}/..:{toxinidir}/../python-common
passenv =
    MYPYPATH
deps =
    mypy
    types-PyYAML
    -rzipapp-reqs.txt
    -c{toxinidir}/../mypy-constrains.txt
commands = mypy --config-file ../mypy.ini {posargs:cephadm.py cephadmlib}

[testenv:flake8]
allowlist_externals = bash
deps =
    flake8 == 5.0.4
    flake8-quotes
commands =
    flake8 --config=tox.ini {posargs:cephadm.py cephadmlib}
    bash -c 'test $(git ls-files 'cephadm.py' 'cephadmlib/*.py' | sort -u | xargs grep "docker.io" | wc -l) == 1'
    bash -c 'test $(git ls-files 'cephadm.py' 'cephadmlib/*.py' | sort -u | xargs grep "quay.io" | wc -l) == 7'
# 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}

[testenv:check-black]
deps =
    black>=23,<24
commands =
    black --check -l78 -t py36 --skip-string-normalization -v cephadmlib/

[testenv:format-black]
deps =
    black>=23,<24
commands =
    black -q -l78 -t py36 --skip-string-normalization cephadmlib/

# test_build env is intentionally left out of the envlist. It is here for developers
# to run locally as it has some unusual requirements: needs podman, etc
[testenv:test_build]
skip_install=true
deps =
  {[testenv]deps}
commands =
  pytest {posargs} tests/build