-
Notifications
You must be signed in to change notification settings - Fork 8
/
tox.ini
174 lines (164 loc) · 6.47 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File: tox.ini (Templated version)
#
##
[local_settings]
# project specific local settings
test_pattern = "test*.py"
#
# Source pathls (unquoted space separated list of files/directories) for linting and format checks
#source_paths = mmcif/ setup.py
source_paths = mmcif/
#
# Start directory path for test discovery
# Each path must reference valid directory that is searchable by Python (i.e. contains __init__.py)
# ** It is harmless to point to paths containing no tests.
#
test_path_1 = "mmcif/tests"
# These are placeholders valid source directories without tests files
test_path_2 = "mmcif/api"
test_path_3 = "mmcif/api"
test_path_4 = "mmcif/api"
#
# Comma separate list of directories for which test coverage will be evaluated
coverage_source_paths = "mmcif/io,mmcif/api,mmcif/tests"
coverage_exclude_paths = "mmcif/__init__.py"
coverage_cutoff = 60
#
## --------------------------------------------------------------------------
## --------------------------------------------------------------------------
## ---------- No project specific setting beyond this point --------------
# Updated: 3-Jul-2019 jdw Cleanup
# 8-Jul-2019 jdw Disable flake8 plugin (pydocstyle compat issue)
# 12-Jul-2019 jdw Add placeholders for up to four test paths
# 13-Jul-2019 jdw Add coverage exclusion
# 21-Nov-2019 jdw py27->py38 update black version
# 1-Jan-2021 jdw py38->py39
##
[tox]
# The complete list of supported test environments to setup and invoke
envlist = format_pep8-{py39}, lint_pylint-{py39}, format_black-{py39}, py{39,27}, test_coverage-{py39}
#
#
minversion = 3.4.0
skip_missing_interpreters = true
skipsdist = false
[testenv]
passenv = CONFIG_SUPPORT_TOKEN_ENV
allowlist_externals = echo
skipsdist = false
commands =
echo "Starting default tests in testenv"
basepython = py312: python3.12
py311: python3.11
py310: python3.10
py39: python3.9
py27: python2.7
[testenv:py27]
description = 'Run unit tests (unittest runner) using {envpython}'
platform=
macos: darwin
linux: linux
skip_install = false
skipsdist = false
recreate = true
alwayscopy=true
usedevelop=true
deps =
-r requirements.txt
commands =
echo "Starting {envname}"
{envpython} -V
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_1} --pattern "{[local_settings]test_pattern}"
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_2} --pattern "{[local_settings]test_pattern}"
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_3} --pattern "{[local_settings]test_pattern}"
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_4} --pattern "{[local_settings]test_pattern}"
echo "Completed {envname}"
[testenv:py3{9,10,11,12}]
description = 'Run unit tests (unittest runner) using {envpython}'
platform=
macos: darwin
linux: linux
skip_install = false
skipsdist = false
recreate = true
alwayscopy=true
usedevelop=true
deps =
-r requirements.txt
commands =
echo "Starting {envname}"
{envpython} -V
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_1} --pattern "{[local_settings]test_pattern}"
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_2} --pattern "{[local_settings]test_pattern}"
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_3} --pattern "{[local_settings]test_pattern}"
{envpython} -m unittest discover -v --start-directory {[local_settings]test_path_4} --pattern "{[local_settings]test_pattern}"
echo "Completed {envname}"
#
[testenv:format_pep8-py3{9,10,11,12}]
description = 'Run selected PEP8 compliance checks (flake8)'
platform=
macos: darwin
linux: linux
deps =
flake8
# This plugin is no longer compatible with latest pydocstyles -
# flake8-docstrings>=0.2.7
flake8-import-order>=0.9
-r requirements.txt
commands =
# Exceptions: D for docstrings, I for imports order and formatting, E302 is slice spacing - W503 multiline spacing incompatible with black
flake8 --max-line-length=185 --ignore=D,I,E203,W503 {[local_settings]source_paths}
#
[testenv:lint_pylint-py3{9,10,11,12}]
description = 'Run linting compliance checks (pylint)'
platform=
macos: darwin
linux: linux
deps =
pylint
-r requirements.txt
commands =
echo "Starting {envname}"
pylint --disable=R,C --reports=n --rcfile={toxinidir}/pylintrc {[local_settings]source_paths}
echo "Completed {envname}"
#
[testenv:format_black-py3{9,10,11,12}]
description = 'Run format compliance checks (black)'
platform=
macos: darwin
linux: linux
deps =
black>=21.5b1
-r requirements.txt
# isort>=4.3.20
commands =
echo "Starting {envname}"
black --check --line-length 185 {[local_settings]source_paths}
# isort -rc rcsb/utils --check-only
echo "Completed {envname}"
#
[testenv:test_coverage-py3{9,10,11,12}]
description = 'Run test coverage analysis'
platform=
macos: darwin
linux: linux
recreate = true
alwayscopy=true
usedevelop=true
skipsdist = false
deps =
coverage
-r requirements.txt
commands =
echo "Starting {envname}"
coverage erase
coverage run --parallel-mode --omit="{[local_settings]coverage_exclude_paths}" --source="{[local_settings]coverage_source_paths}" -m unittest discover -v --start-directory {[local_settings]test_path_1} --pattern "{[local_settings]test_pattern}"
coverage run --parallel-mode --omit="{[local_settings]coverage_exclude_paths}" --source="{[local_settings]coverage_source_paths}" -m unittest discover -v --start-directory {[local_settings]test_path_2} --pattern "{[local_settings]test_pattern}"
coverage run --parallel-mode --omit="{[local_settings]coverage_exclude_paths}" --source="{[local_settings]coverage_source_paths}" -m unittest discover -v --start-directory {[local_settings]test_path_3} --pattern "{[local_settings]test_pattern}"
coverage run --parallel-mode --omit="{[local_settings]coverage_exclude_paths}" --source="{[local_settings]coverage_source_paths}" -m unittest discover -v --start-directory {[local_settings]test_path_4} --pattern "{[local_settings]test_pattern}"
echo " ------- Consolidating {envname} data ----------"
coverage combine
echo " ------- Building {envname} reports ----------"
coverage report --fail-under={[local_settings]coverage_cutoff}
- coverage xml
echo "Completed {envname}"