qiskit/tox.ini

104 lines
3.3 KiB
INI

[tox]
minversion = 4.0
envlist = py38, py39, py310, py311, py312, lint-incr
isolated_build = true
[testenv]
# The colons in the substitutions below let us re-use the `install_command` in
# places where `tox` doesn't automatically fill in those values.
install_command = pip install -c{toxinidir}/constraints.txt -U {opts:} {packages:}
setenv =
VIRTUAL_ENV={envdir}
LANGUAGE=en_US
LC_ALL=en_US.utf-8
ARGS="-V"
QISKIT_SUPRESS_PACKAGING_WARNINGS=Y
QISKIT_TEST_CAPTURE_STREAMS=1
QISKIT_PARALLEL=FALSE
passenv =
RUSTUP_TOOLCHAIN
RAYON_NUM_THREADS
OMP_NUM_THREADS
QISKIT_PARALLEL
RUST_BACKTRACE
SETUPTOOLS_ENABLE_FEATURES
QISKIT_TESTS
QISKIT_IN_PARALLEL
QISKIT_DOCS_GITHUB_BRANCH_NAME
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-dev.txt
commands =
stestr run {posargs}
[testenv:lint]
basepython = python3
# `pylint` will examine the source code, not the version that would otherwise be
# installed in `site-packages`, so we use an editable install to make sure the
# compiled modules are built into a valid place for it to find them.
package = editable
allowlist_externals = cargo
commands =
black --check {posargs} qiskit test tools examples setup.py
cargo fmt --check
ruff check qiskit test tools examples setup.py
cargo clippy -- -D warnings
pylint -rn qiskit test tools
# This line is commented out until #6649 merges. We can't run this currently
# via tox because tox doesn't support globbing
# pylint -rn --disable='invalid-name,missing-module-docstring,redefined-outer-name' examples/python/*.py
python {toxinidir}/tools/verify_headers.py qiskit test tools examples crates
python {toxinidir}/tools/find_optional_imports.py
python {toxinidir}/tools/find_stray_release_notes.py
reno -q lint
[testenv:lint-incr]
basepython = python3
allowlist_externals = git
commands =
ruff check qiskit test tools examples setup.py
black --check {posargs} qiskit test tools examples setup.py
-git fetch -q https://github.com/Qiskit/qiskit.git :lint_incr_latest
python {toxinidir}/tools/pylint_incr.py -rn -j4 -sn --paths :/qiskit/*.py :/test/*.py :/tools/*.py
python {toxinidir}/tools/pylint_incr.py -rn -j4 -sn --disable='invalid-name,missing-module-docstring,redefined-outer-name' --paths :(glob,top)examples/python/*.py
python {toxinidir}/tools/verify_headers.py qiskit test tools examples crates
python {toxinidir}/tools/find_optional_imports.py
python {toxinidir}/tools/find_stray_release_notes.py
reno -q lint
[testenv:black]
skip_install = true
deps =
-r requirements-dev.txt
commands = black {posargs} qiskit test tools examples setup.py
[testenv:coverage]
basepython = python3
setenv =
{[testenv]setenv}
PYTHON=coverage3 run --source qiskit --parallel-mode
commands_pre =
{[testenv]install_command} -r{toxinidir}/requirements-optional.txt
commands =
stestr run {posargs}
coverage3 combine
coverage3 report
[testenv:docs]
basepython = python3
setenv =
{[testenv]setenv}
RUST_DEBUG=1 # Faster to compile.
commands_pre =
{[testenv]install_command} -r{toxinidir}/requirements-optional.txt
commands =
sphinx-build -W -j auto -T --keep-going -b html docs/ docs/_build/html {posargs}
[testenv:docs-clean]
skip_install = true
deps =
allowlist_externals =
rm
commands =
rm -rf {toxinidir}/docs/stubs/ {toxinidir}/docs/_build {toxinidir}/docs/locale