generated from DARMA-tasking/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
48 lines (40 loc) · 1.8 KB
/
tox.ini
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
# This is the tox configuration file to run tests, linter and coverage.
# Configuration doc available at https://tox.wiki/en/3.1.0/config.html#substitutions-for-virtualenv-related-sections
[tox]
requires =
tox>=4.6.0
skipsdist = true
envlist = py{38,39,310,311}, pylint, coverage
[gh-actions]
python =
3.8: py38, pylint, coverage
3.9: py39
3.10: py310
3.11: py311
[testenv]
sitepackages = false
deps =
-r{toxinidir}/requirements.txt
bash
allowlist_externals =
bash
alwayscopy = true # Force virtualenv to always copy rather than symlink
download = true # upgrade pip/wheel/setuptools to the latest version
recreate = true # Always recreate virtual environment
[testenv:py{38,39,310,311}]
commands =
# Unit test
bash -c 'python -m unittest discover -s '{toxinidir}'/tests -p "test*.py" -t '{toxinidir}'/tests -v'
# CI artifacts as JUnit reports
bash -c 'pip install unittest-xml-reporting'
bash -c 'python -m xmlrunner discover -s '{toxinidir}'/tests -p "test*.py" -t '{toxinidir}'/tests -v -o artifacts/unittest/reports'
# refered command
; bash -c 'if [[ ! -z ${CI} ]]; then python -m unittest discover -s $(pwd)/tests -p "test*.py" -t $(pwd) -v; fi'
; bash -c 'if [[ -z "$CI" ]]; then pip install unittest-xml-reporting && python -m xmlrunner discover -s $(pwd)/tests -p "test*.py" -t $(pwd) -v -o artifacts/unittest/reports; fi' # ci artifacts as junit reports
[testenv:pylint]
commands =
bash -c 'mkdir -p artifacts; pylint --rcfile=.pylintrc --output-format=text,text:artifacts/pylint.txt src'
[testenv:coverage]
commands =
bash -c 'echo "WIP"'
; bash -c 'mkdir -p artifacts; coverage run --source $(pwd)/src -m unittest discover -s "$(pwd)/tests" -p "test*.py" -t $(pwd); coverage html -d artifacts; coverage report -m | tee artifacts/coverage.txt'