[tox]
envlist =
    py{37,38}-orange-{oldest, latest, released}
skip_missing_interpreters = true
isolated_build = true

[testenv]
# must use latest pip (version 20.3.1 enables Big Sur support - https://github.com/pypa/pip/issues/9138)
pip_version = pip
extras = test
passenv = *
# we MUST changedir to avoid installed being shadowed by working dir
# https://github.com/tox-dev/tox/issues/54
# https://github.com/tox-dev/tox/issues/514
changedir =
    {envsitepackagesdir}
setenv =
    # Raise deprecations as errors in our tests
    ORANGE_DEPRECATIONS_ERROR=y
    # Need this otherwise unittest installs a warning filter that overrides
    # our desire to have OrangeDeprecationWarnings raised
    PYTHONWARNINGS=module
    # set coverage output and project config
    COVERAGE_FILE = {toxinidir}/.coverage
    COVERAGE_RCFILE = {toxinidir}/.coveragerc
deps =
    pyqt5==5.12.*
    pyqtwebengine==5.12.*
    oldest: scikit-learn~=0.22.0
    oldest: orange3==3.28.0

    # Use newer canvas-core and widget-base to avoid segfaults on windows
    oldest: orange-canvas-core==0.1.19
    oldest: orange-widget-base==4.12.0
    latest: git+git://github.com/biolab/orange3.git#egg=orange3
    latest: git+git://github.com/biolab/orange3-network.git#egg=orange3-network
    latest: git+git://github.com/biolab/orange-canvas-core.git#egg=orange-canvas-core

    # TODO: some tests require orange3-network add-on. Skip for now, wheels not on pypi.
    # orange3-network
    # oldest: orange3-network==1.3.0
    # latest: git+git://github.com/biolab/orange-widget-base.git#egg=orange-widget-base
commands_pre =
    # Verify installed packages have compatible dependencies
    pip check
    # freeze environment
    pip freeze
commands =
    python -c 'import nltk; from orangecontrib.text.misc.nltk_data_download import NLTK_DATA, nltk_data_dir; nltk.download(NLTK_DATA)'
    coverage run -m unittest discover -v --start-directory orangecontrib/text
    coverage report
