LiberTEM/LiberTEM

View on GitHub
tox.ini

Summary

Maintainability
Test Coverage
[tox]
envlist = py{36,37,38,39,310}, py{36,37,38,39,310}-data, notebooks

[testenv]
commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml {posargs:tests/}
    # win_tweaks.py depends on modules that are only available on Windows
    pytest --doctest-modules --ignore=src/libertem/common/win_tweaks.py src/libertem/
deps=
    -rtest_requirements.txt
    # Inject release candidates for testing
    -roverride_requirements.txt
    cuda101: cupy-cuda101
    cuda102: cupy-cuda102
    cuda110: cupy-cuda110
    cuda114: cupy-cuda114
extras=
    hdbscan
    bqplot
    hdf5plugin
setenv=
    # Using pytest in combination with tox on files that are part of the installed package
    # leads to collisions between the local source tree and the installed package when running tests.
    # See https://github.com/pytest-dev/pytest/issues/2042
    PY_IGNORE_IMPORTMISMATCH=1
    # Debug asyncio problems - has some perf overhead, so only enable if there is a problem
    # PYTHONASYNCIODEBUG=1
    # Dask configuration to reduce background load:
    DASK_DISTRIBUTED__ADMIN__TICK__INTERVAL=1000
    DASK_DISTRIBUTED__SCHEDULER__WORK_STEALING_INTERVAL=1000
    DASK_DISTRIBUTED__WORKER__PROFILE__CYCLE=60000
    DASK_DISTRIBUTED__WORKER__PROFILE__INTERVAL=30000
    NUMBA_FULL_TRACEBACKS=1
    NUMBA_BOUNDSCHECK=1
passenv=
    DASK_SCHEDULER_ADDRESS
    TESTDATA_BASE_PATH
    NUMBA_*
    # HyperSpy expects this on Windows
    PROGRAMFILES

[testenv:numba_coverage]
commands=
    pytest --durations=5 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg -m with_numba --junitxml=junit.xml {posargs:tests/}
setenv=
    NUMBA_DISABLE_JIT=1

[testenv:py39-data]
deps=
    -rtest_requirements.txt
    # Important fix for https://github.com/ercius/openNCEM/pull/40
    git+https://github.com/ercius/openNCEM.git@123d1ca#egg=ncempy
    hyperspy
    stemtool
    mrcfile
    pyxem
    pims
    scikit-image
    pint<0.20

commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml tests/io/datasets tests/executor/test_functional.py {posargs}

[testenv:py310-data]
deps=
    -rtest_requirements.txt
    # Important fix for https://github.com/ercius/openNCEM/pull/40
    git+https://github.com/ercius/openNCEM.git@123d1ca#egg=ncempy
    hyperspy
    stemtool
    mrcfile
    pims
    scikit-image
    pint<0.20

commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml tests/io/datasets tests/executor/test_functional.py {posargs}

[testenv:py{36,37,38}-data]
deps=
    -rtest_requirements.txt
    hyperspy
    orix
    stemtool
    mrcfile
    pyxem
    pims
    scikit-image
    pint<0.20

commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml tests/io/datasets tests/executor/test_functional.py {posargs}

[testenv:notebooks]
deps=
    -rtest_requirements.txt
    nbval
    nbqa
    libertem-blobfinder
    hyperspy
    pyxem
    scikit-image
    pint<0.20
extras=
    hdbscan
    bqplot
commands=
    pytest --durations=10 --cov=libertem --cov-report=term --cov-report=html --cov-report=xml --cov-config=setup.cfg --junitxml=junit.xml --nbval --sanitize-with nbval_sanitize.cfg -p no:python --current-env {posargs:examples/}
passenv=
    TESTDATA_BASE_PATH
    # HyperSpy expects this on Windows
    PROGRAMFILES

[testenv:benchmark]
changedir={toxinidir}
commands=
    pytest --benchmark-enable --benchmark-warmup=on --benchmark-autosave --benchmark-storage "{toxinidir}/benchmark_results" -m "not compilation" {posargs:benchmarks/}
    pytest --benchmark-enable --benchmark-warmup=off --benchmark-autosave --benchmark-storage "{toxinidir}/benchmark_results" -m "compilation" {posargs:benchmarks/}

[testenv:benchmark-cuda{101,102,110,114}]
changedir={toxinidir}
commands=
    {[testenv:benchmark]commands}

[testenv:build_client]
changedir={toxinidir}
skipsdist=True
skip_install=True
passenv=APPDATA
deps=
commands=
    python setup.py build_client copy_client

[testenv:docs]
changedir={toxinidir}
basepython=python3
whitelist_externals=
    make
setenv=
    PYTHONPATH={toxinidir}
commands=
    python "{toxinidir}/scripts/build-authors-contributors"
    python "{toxinidir}/scripts/cli-help"
    sphinx-autobuild -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html" --port 8008 {posargs} -j auto
deps=
    -rdocs_requirements.txt
    # Inject release candidates for doctest testing
    -roverride_requirements.txt
skipsdist=True

# just a non-watching version of the docs environment above, also building twice for bibs
[testenv:docs-build-ci]
changedir={toxinidir}
basepython=python3
setenv=
    PYTHONPATH={toxinidir}
commands=
    python "{toxinidir}/scripts/build-authors-contributors"
    python "{toxinidir}/scripts/cli-help"
    # Two runs to get complete bibliography. The first one will throw warnings about missing
    # citations.
    sphinx-build -j auto -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    sphinx-build -j auto -W -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
deps=
    -rdocs_requirements.txt
    # Inject release candidates for doctest testing
    -roverride_requirements.txt
skipsdist=True
passenv=
    HOME

[testenv:docs-check]
changedir={toxinidir}
basepython=python3
setenv=
    PYTHONPATH={toxinidir}
commands=
    python "{toxinidir}/scripts/build-authors-contributors"
    python "{toxinidir}/scripts/cli-help"
    # Two runs to get complete bibliography. The first one will throw warnings about missing
    # citations.
    sphinx-build -j auto -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    sphinx-build -j auto -W -b html "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    sphinx-build -j auto -b doctest "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    # sphinx-build -b linkcheck "{toxinidir}/docs/source" "{toxinidir}/docs/build/html"
    # cat docs/build/html/output.txt
deps=
    -rdocs_requirements.txt
skipsdist=True
whitelist_externals=
    cat
passenv=
    HOME

[testenv:notebooks_gen]
deps=
    -rtest_requirements.txt
    libertem-blobfinder
    hyperspy
    pyxem
    scikit-image
    # for hyperspy-integration.ipynb
    graphviz
    pyopencl
extras=
    hdbscan
    bqplot
commands=
    jupyter nbconvert --allow-errors --to notebook --output-dir "{toxinidir}/examples/generated/" --execute "{toxinidir}/examples/*.ipynb"
passenv=
    TESTDATA_BASE_PATH
    # HyperSpy expects this on Windows
    PROGRAMFILES
setenv=
    PYTHONWARNINGS=ignore
    DASK_LOGGING__DISTRIBUTED=60
    KMP_WARNINGS=0