; Cross-platform test automation for DataTools.
;
; Drives the pytest suite under multiple Python versions on Linux, macOS,
; and Windows. Use:
;
;   tox                    # all envs
;   tox -e py312           # one Python version
;   tox -e e2e             # CLI smoke tests
;   tox -e install         # import / dependency sanity
;   tox -e lint            # static checks (mypy / ruff if installed)
;   tox -e coverage        # full suite with coverage report
;
; Adding a new fixture: drop the CSV/XLSX into test-cases/ and re-run.
; tests/test_fixtures_sweep.py picks new files up automatically.

[tox]
envlist = py310, py311, py312, py313, install, e2e
skip_missing_interpreters = true
isolated_build = false

[testenv]
description = Run the full pytest suite under {envname}.
deps =
    -r requirements.txt
    -r requirements-dev.txt
commands =
    python run_tests.py {posargs}
passenv =
    HOME
    USER
    LANG
    LC_ALL
    PATH
setenv =
    PYTHONIOENCODING = utf-8
    PYTHONUTF8 = 1

[testenv:install]
description = Verify imports and CLI entry points work after a fresh install.
commands =
    python run_tests.py --install -v

[testenv:e2e]
description = End-to-end CLI smoke tests against real fixtures.
commands =
    python run_tests.py --e2e -v

[testenv:fixtures]
description = Sweep test-cases/ for any newly-dropped fixtures.
commands =
    python run_tests.py --fixtures -v

[testenv:coverage]
description = Full suite with coverage report.
commands =
    python run_tests.py --coverage

[testenv:lint]
description = Static checks (run only if the optional tools are installed).
deps =
    -r requirements.txt
    ruff>=0.5; python_version >= "3.10"
    mypy>=1.10; python_version >= "3.10"
allowlist_externals = sh
commands =
    sh -c "command -v ruff && ruff check src/ tests/ || echo 'ruff not installed; skipping'"
    sh -c "command -v mypy && mypy src/ || echo 'mypy not installed; skipping'"
