blob: 441910a7dbd4803d1ce6fec61ba4bfa874401e3c [file] [log] [blame]
beierlmbb0f2a32021-02-16 13:30:35 -05001#######################################################################################
2# Copyright ETSI Contributors and Others.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
Helena McGough95b92b32017-10-01 12:03:53 +010010# Unless required by applicable law or agreed to in writing, software
beierlmbb0f2a32021-02-16 13:30:35 -050011# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
Helena McGough95b92b32017-10-01 12:03:53 +010017
Helena McGough95b92b32017-10-01 12:03:53 +010018[tox]
beierlmbb0f2a32021-02-16 13:30:35 -050019envlist = black, cover, flake8, pylint, safety
beierl2329b922019-07-12 11:55:36 -040020
beierlmbb0f2a32021-02-16 13:30:35 -050021[tox:jenkins]
22toxworkdir = /tmp/.tox
Helena McGough95b92b32017-10-01 12:03:53 +010023
24[testenv]
beierl2329b922019-07-12 11:55:36 -040025usedevelop = True
beierlmf3c0ac42022-01-13 11:43:03 -050026basepython = python3.8
beierl2329b922019-07-12 11:55:36 -040027setenv = VIRTUAL_ENV={envdir}
28 PYTHONDONTWRITEBYTECODE = 1
beierlmbb0f2a32021-02-16 13:30:35 -050029deps = -r{toxinidir}/requirements.txt
garciadeblase11d5662022-11-14 00:07:17 +010030parallel_show_output = true
beierl2329b922019-07-12 11:55:36 -040031
beierlmbb0f2a32021-02-16 13:30:35 -050032#######################################################################################
33[testenv:black]
garciadeblasd9a11dd2024-01-30 11:45:09 +010034deps = black==23.12.1
beierlmbb0f2a32021-02-16 13:30:35 -050035skip_install = true
36commands =
garciadeblase11d5662022-11-14 00:07:17 +010037 black --check --diff osm_mon/
38 black --check --diff setup.py
beierlmbb0f2a32021-02-16 13:30:35 -050039
40
41#######################################################################################
beierl2329b922019-07-12 11:55:36 -040042[testenv:cover]
beierlmbb0f2a32021-02-16 13:30:35 -050043deps = {[testenv]deps}
44 -r{toxinidir}/requirements-dev.txt
45 -r{toxinidir}/requirements-test.txt
beierl2329b922019-07-12 11:55:36 -040046commands =
beierlmbb0f2a32021-02-16 13:30:35 -050047 sh -c 'rm -f nosetests.xml'
48 coverage erase
49 nose2 -C --coverage osm_mon
50 coverage report --omit='*tests*'
51 coverage html -d ./cover --omit='*tests*'
52 coverage xml -o coverage.xml --omit=*tests*
garciadeblas02814d92023-03-29 00:08:39 +020053allowlist_externals = sh
Helena McGough95b92b32017-10-01 12:03:53 +010054
beierlmbb0f2a32021-02-16 13:30:35 -050055
56#######################################################################################
Benjamin Diazb7261612018-05-11 18:00:16 -030057[testenv:flake8]
Mark Beierle1056df2022-11-28 06:29:25 -050058deps = flake8==5.0.4
Benjamin Diazb7261612018-05-11 18:00:16 -030059commands =
beierlmbb0f2a32021-02-16 13:30:35 -050060 flake8 osm_mon/ setup.py
Helena McGough95b92b32017-10-01 12:03:53 +010061
Helena McGough95b92b32017-10-01 12:03:53 +010062
beierlmbb0f2a32021-02-16 13:30:35 -050063#######################################################################################
64[testenv:pylint]
65deps = {[testenv]deps}
66 -r{toxinidir}/requirements-dev.txt
67 -r{toxinidir}/requirements-test.txt
68 pylint
69commands =
garciadeblase11d5662022-11-14 00:07:17 +010070 pylint -E osm_mon
beierlmbb0f2a32021-02-16 13:30:35 -050071
72
73#######################################################################################
74[testenv:safety]
75setenv =
76 LC_ALL=C.UTF-8
77 LANG=C.UTF-8
78deps = {[testenv]deps}
79 safety
80commands =
81 - safety check --full-report
82
83
84#######################################################################################
85[testenv:pip-compile]
beierlma3807d82022-06-24 21:29:56 -040086deps = pip-tools==6.6.2
beierlmf3c0ac42022-01-13 11:43:03 -050087skip_install = true
88whitelist_externals = bash
89 [
beierlmbb0f2a32021-02-16 13:30:35 -050090commands =
beierlmf3c0ac42022-01-13 11:43:03 -050091 - bash -c "for file in requirements*.in ; do \
92 UNSAFE="" ; \
93 if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
94 pip-compile -rU --no-header $UNSAFE $file ;\
95 out=`echo $file | sed 's/.in/.txt/'` ; \
96 sed -i -e '1 e head -16 tox.ini' $out ;\
97 done"
beierlmbb0f2a32021-02-16 13:30:35 -050098
99
100#######################################################################################
101[testenv:dist]
102deps = {[testenv]deps}
103 -r{toxinidir}/requirements-dist.txt
104
105# In the commands, we copy the requirements.txt to be presented as a source file (.py)
106# so it gets included in the .deb package for others to consume
107commands =
108 sh -c 'cp requirements.txt osm_mon/requirements.txt'
109 python3 setup.py --command-packages=stdeb.command sdist_dsc
110 sh -c 'cd deb_dist/osm-mon*/ && dpkg-buildpackage -rfakeroot -uc -us'
111 sh -c 'rm osm_mon/requirements.txt'
112whitelist_externals = sh
113
114#######################################################################################
Helena McGough95b92b32017-10-01 12:03:53 +0100115[flake8]
beierlmbb0f2a32021-02-16 13:30:35 -0500116ignore =
117 W291,
118 W293,
119 W503,
120 E123,
121 E125,
122 E226,
123 E241
124exclude =
125 .git,
126 __pycache__,
127 .tox,
Benjamin Diazb7261612018-05-11 18:00:16 -0300128max-line-length = 120
Helena McGough95b92b32017-10-01 12:03:53 +0100129show-source = True
Helena McGough95b92b32017-10-01 12:03:53 +0100130builtins = _