blob: 8d21de4f1eb6c025246dc1c478bd85ff793d04f7 [file] [log] [blame]
#
# Tox global configuration
#
[tox]
envlist = py37,py{38,39,310}-nocover
skip_missing_interpreters = true
isolated_build = true
# Configuration variables to share across environments
[config]
BST_PLUGINS_EXPERIMENTAL_VERSION = 74d0a8d918563e70e6d140e0bc4765fbf4945dc5
BST_PLUGINS_VERSION = ed65975aa3b0629a36112d474366ac86d4da8261
#
# 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{37,38,39,310}-!nocover: True
commands =
# Running with coverage reporting enabled
py{37,38,39,310}-!plugins-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc {posargs}
# Running with coverage reporting disabled
py{37,38,39,310}-!plugins-nocover: pytest --basetemp {envtmpdir} {posargs}
# Running external plugins tests with coverage reporting enabled
py{37,38,39,310}-plugins-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc --plugins {posargs}
# Running external plugins tests with coverage disabled
py{37,38,39,310}-plugins-nocover: pytest --basetemp {envtmpdir} --plugins {posargs}
commands_post:
py{37,38,39,310}-!nocover: mkdir -p .coverage-reports
py{37,38,39,310}-!nocover: mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
deps =
py{37,38,39,310}: -rrequirements/requirements.txt
py{37,38,39,310}: -rrequirements/dev-requirements.txt
py{37,38,39,310}: git+https://github.com/apache/buildstream-plugins.git@{env:BST_PLUGINS_VERSION:{[config]BST_PLUGINS_VERSION}}
# Install local sample plugins for testing pip plugin origins
py{37,38,39,310}: {toxinidir}/tests/plugins/sample-plugins
# Install external plugins for plugin tests
py{37,38,39,310}-plugins: git+https://gitlab.com/buildstream/bst-plugins-experimental.git@{env:BST_PLUGINS_EXPERIMENTAL_VERSION:{[config]BST_PLUGINS_EXPERIMENTAL_VERSION}}#egg=bst_plugins_experimental[deb]
# 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
ARTIFACT_INDEX_SERVICE
ARTIFACT_STORAGE_SERVICE
BST_CAS_STAGING_ROOT
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
BST_PLUGINS_EXPERIMENTAL_VERSION
#
# These keys are not inherited by any other sections
#
setenv =
py{37,38,39,310}: COVERAGE_FILE = {envtmpdir}/.coverage
py{37,38,39,310}: BST_TEST_HOME = {envtmpdir}
py{37,38,39,310}: BST_TEST_XDG_CACHE_HOME = {envtmpdir}/cache
py{37,38,39,310}: BST_TEST_XDG_CONFIG_HOME = {envtmpdir}/config
py{37,38,39,310}: BST_TEST_XDG_DATA_HOME = {envtmpdir}/share
# This is required to run tests with python 3.7
py37: SETUPTOOLS_ENABLE_FEATURES = "legacy-editable"
# This is required to get coverage for Cython
py{37,38,39,310}-!nocover: BST_CYTHON_TRACE = 1
randomized: PYTEST_ADDOPTS="--random-order-bucket=global"
whitelist_externals =
py{37,38,39,310}:
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==22.3.0
commands =
black {posargs: src tests doc/source/conf.py setup.py}
#
# Code format checkers
#
[testenv:format-check]
skip_install = True
deps =
black==22.3.0
commands =
black --check --diff {posargs: src tests doc/source/conf.py setup.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/buildstream tests doc/source/conf.py setup.py}
deps =
-rrequirements/requirements.txt
-rrequirements/dev-requirements.txt
#
# Running static type checkers
#
[testenv:mypy]
skip_install = True
commands =
mypy {posargs}
deps =
mypy==0.910
types-protobuf
types-python-dateutil
types-setuptools
types-ujson
-rrequirements/requirements.txt
-rrequirements/dev-requirements.txt
#
# 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
git+https://github.com/apache/buildstream-plugins.git@{env:BST_PLUGINS_VERSION:{[config]BST_PLUGINS_VERSION}}
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
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
# When building using PEP518 and 517, we don't want default dependencies
# installed by the base environment.
[testenv:.package]
deps =