18306b50cc4a36914852fe9e382f8f2d08288f48
[sim/a1-interface.git] / tox.ini
1 # ==================================================================================
2 #       Copyright (c) 2020-2022 Nordix
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 #
10 #   Unless required by applicable law or agreed to in writing, software
11 #   distributed under the License is distributed on an "AS IS" BASIS,
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #   See the License for the specific language governing permissions and
14 #   limitations under the License.
15 # ==================================================================================
16
17 [tox]
18 envlist = code,docs,docs-linkcheck
19 minversion = 4.0
20 skipsdist = true
21
22 ; basic test and coverage jobs
23 [testenv:code]
24 basepython = python3
25 deps=
26     pytest
27     coverage
28     pytest-cov
29     connexion==2.14.2
30     Flask==2.2.5
31
32 setenv =
33     TESTS_BASE_PATH = {toxinidir}/near-rt-ric-simulator/tests
34 commands =
35 ; Two test execution with pytest is needed as each simulator version need to be started separately. In addtion, each simulator need
36 ; environment setup that would cause interference if both simulator are executed in the same pytest run.
37 ; Each pytest run also need to point to the specific test case file for the reasons mentioned above.
38 ; Note that the second pytest (additional pytest added in the future) uses the 'append' flag to combine the coverage data
39 ; from the previous tests. The first pytest shall not have the 'append' since the it is supposed to erase previous coverage data
40 ; from earlier tox run.
41     pytest --cov {toxinidir}/near-rt-ric-simulator --cov-report xml --cov-report term-missing --cov-report html --cov-fail-under=70 \
42     {toxinidir}/near-rt-ric-simulator/tests/test_osc_2_1_0.py
43     pytest --cov-append --cov {toxinidir}/near-rt-ric-simulator --cov-report xml --cov-report term-missing --cov-report html \
44     --cov-fail-under=70 {toxinidir}/near-rt-ric-simulator/tests/test_std_1_1_3.py
45     pytest --cov-append --cov {toxinidir}/near-rt-ric-simulator --cov-report xml --cov-report term-missing --cov-report html \
46     --cov-fail-under=70 {toxinidir}/near-rt-ric-simulator/tests/test_std_2_0_0.py
47     coverage xml -i
48
49 # doc jobs
50 [testenv:docs]
51 allowlist_externals = echo
52 basepython = python3
53 deps = -r{toxinidir}/docs/requirements-docs.txt
54 commands =
55     sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
56     echo "Generated docs available in {toxinidir}/docs/_build/html"
57
58 [testenv:docs-linkcheck]
59 skipsdist = true
60 basepython = python3
61 deps = -r{toxinidir}/docs/requirements-docs.txt
62 commands =
63     sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck