summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 85697085dacb3b14edd6df725a7e12642e54e34e (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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#
# Tox global configuration
#
[tox]
envlist = py{35,36,37,38}
skip_missing_interpreters = true
isolated_build = true

#
# Defaults for all environments
#
# Anything specified here is inherited by the sections
#
[testenv]
usedevelop =
    # This is required by Cython in order to get coverage for cython files.
    py{35,36,37,38}-!nocover: True

commands =
    # Running with coverage reporting enabled
    py{35,36,37,38}-!external-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc {posargs}
    py{35,36,37,38}-!nocover: mkdir -p .coverage-reports
    external-!nocover: {envpython} {toxinidir}/tests/external_plugins.py {envtmpdir} --cov=buildstream --cov-append {posargs}
    py{35,36,37,38}-!external-!nocover: mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
    py{35,36,37,38}-external-!nocover: - mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
    # Running with coverage reporting disabled
    py{35,36,37,38}-!external-nocover: pytest --basetemp {envtmpdir} {posargs}
    external-nocover: {envpython} {toxinidir}/tests/external_plugins.py {envtmpdir} {posargs}
deps =
    py{35,36,37,38}: -rrequirements/requirements.txt
    py{35,36,37,38}: -rrequirements/dev-requirements.txt
    py{35,36,37,38}: -rrequirements/plugin-requirements.txt
    git+https://gitlab.com/BuildStream/bst-plugins-experimental.git@5b004e5850ab0e987c00c681b2c768f6ae02586b

    # Only require coverage and pytest-cov when using it
    !nocover: -rrequirements/cov-requirements.txt

    # Install pytest-random-order for '-randomized'
    randomized: pytest-random-order
passenv =
    ARTIFACT_CACHE_SERVICE
    BST_CAS_STAGING_ROOT
    BST_FORCE_BACKEND
    BST_FORCE_SANDBOX
    BST_FORCE_START_METHOD
    GI_TYPELIB_PATH
    INTEGRATION_CACHE
    http_proxy
    HTTP_PROXY
    https_proxy
    HTTPS_PROXY
    no_proxy
    NO_PROXY
    REMOTE_EXECUTION_SERVICE
    SOURCE_CACHE_SERVICE
    SSL_CERT_FILE
#
# These keys are not inherited by any other sections
#
setenv =
    py{35,36,37,38}: COVERAGE_FILE = {envtmpdir}/.coverage
    py{35,36,37,38}: BST_TEST_HOME = {envtmpdir}
    py{35,36,37,38}: BST_TEST_XDG_CACHE_HOME = {envtmpdir}/cache
    py{35,36,37,38}: BST_TEST_XDG_CONFIG_HOME = {envtmpdir}/config
    py{35,36,37,38}: BST_TEST_XDG_DATA_HOME = {envtmpdir}/share
    # This is required to get coverage for Cython
    py{35,36,37,38}-!nocover: BST_CYTHON_TRACE = 1
    randomized: PYTEST_ADDOPTS="--random-order-bucket=global"

whitelist_externals =
    py{35,36,37,38}:
        mv
        mkdir

#
# Environment for native windows
#
[testenv:win32]
commands = 
    bst help
    cmd /C md testdir
    bst init testdir --project-name="test"
deps = 
    -rrequirements/requirements.txt
    -rrequirements/dev-requirements.txt
    colorama
    windows-curses
    cython
    .
whitelist_externals = 
    bst
    cmd

#
# Coverage reporting
#
[testenv:coverage]
# This is required by Cython in order to get coverage for cython files.
usedevelop = True

commands =
    coverage combine --rcfile={toxinidir}/.coveragerc {toxinidir}/.coverage-reports/
    coverage html --rcfile={toxinidir}/.coveragerc --directory={toxinidir}/.coverage-reports/
    coverage report --rcfile={toxinidir}/.coveragerc --show-missing
deps =
    -rrequirements/cov-requirements.txt
setenv =
    COVERAGE_FILE = {toxinidir}/.coverage-reports/.coverage

#
# Code formatters
#
[testenv:format]
skip_install = True
deps =
    black==19.10b0
commands =
    black {posargs: src tests doc/source/conf.py}

#
# Code format checkers
#
[testenv:format-check]
skip_install = True
deps =
    black==19.10b0
commands =
    black --check --diff {posargs: src tests doc/source/conf.py}

#
# Running linters
#
[testenv:lint]
commands_pre =
    # Build C extensions to allow Pylint to analyse them
    {envpython} setup.py build_ext --inplace

commands =
    pylint {posargs: src tests doc/source/conf.py}
deps =
    -rrequirements/requirements.txt
    -rrequirements/dev-requirements.txt
    -rrequirements/plugin-requirements.txt

#
# Running static type checkers
#
[testenv:mypy]
skip_install = True
commands =
    mypy {posargs}
deps =
    mypy==0.730


#
# Building documentation
#
[testenv:docs]
commands =
    make -C doc
# sphinx_rtd_theme < 0.4.2 breaks search functionality for Sphinx >= 1.8
deps =
    sphinx >= 1.8.5
    sphinx-click
    sphinx_rtd_theme >= 0.4.2
    pytest
    -rrequirements/requirements.txt
    -rrequirements/plugin-requirements.txt
    git+https://gitlab.com/BuildStream/bst-plugins-experimental.git@be5ac19e5062bc23a46ed8ce7aa2958a2653c917#egg=bst_plugins_experimental[ostree]
passenv =
    BST_FORCE_SESSION_REBUILD
    BST_SOURCE_CACHE
    HOME
    LANG
    LC_ALL
whitelist_externals =
    make

#
# (re-)Generating man pages
#
[testenv:man]
commands =
    python3 setup.py --command-packages=click_man.commands man_pages
deps =
    click-man >= 0.3.0
    -rrequirements/requirements.txt

#
# Usefull for running arbitrary scripts in a BuildStream virtual env
#
[testenv:venv]
commands = {posargs}
deps =
    -rrequirements/requirements.txt
    -rrequirements/dev-requirements.txt
    -rrequirements/plugin-requirements.txt
whitelist_externals = *


#
# Convenience environment for running individual tests from the
# battery of templated source tests.
#
# You should pass this the part of a test node's id after "::". For
# example, to run the test
# buildstream/testing/_sourcetests/fetch.py::test_fetch_cross_junction[git-inline]
# you would do tox -e sourcetests -- test_fetch_cross_junction[git-inline]
#
# This does rely on the fact that none of the tests in
# buildstream.testing have the same name.
#
[testenv:sourcetests]
commands = pytest --basetemp {envtmpdir} --ignore tests -k "{posargs}"
deps =
    -rrequirements/requirements.txt
    -rrequirements/dev-requirements.txt
    -rrequirements/plugin-requirements.txt

# When building using PEP518 and 517, we don't want default dependencies
# installed by the base environment.
[testenv:.package]
deps =