| [tox] | |
| envlist = py311, | |
| py312, | |
| py313, | |
| py314, | |
| py315, | |
| pypy311, | |
| coverage, | |
| docs | |
| minversion = 4.0 | |
| skip_missing_interpreters = true | |
| isolated_build = true | |
| [testenv] | |
| description = run the unit tests with pytest under {basepython} | |
| setenv = | |
| COVERAGE_FILE={toxworkdir}/.coverage.{envname} | |
| PYTEST_ADDOPTS=-n auto --dist worksteal {env:PYTEST_ADDOPTS:} | |
| passenv = DATEUTIL_MAY_CHANGE_TZ, TOXENV, CI, CODECOV_*, SYSTEM_*, AGENT_*, BUILD_*, TF_BUILD, TZ | |
| commands = python -m pytest {posargs: "{toxinidir}/tests" "{toxinidir}/docs" --cov-config="{toxinidir}/tox.ini" --cov=dateutil} | |
| deps = -rrequirements-dev.txt | |
| [testenv:coverage] | |
| description = combine coverage data and create reports | |
| deps = coverage | |
| skip_install = True | |
| changedir = {toxworkdir} | |
| setenv = COVERAGE_FILE=.coverage | |
| commands = python -m coverage erase | |
| python -m coverage combine | |
| python -m coverage report --rcfile={toxinidir}/tox.ini | |
| python -m coverage xml | |
| [testenv:codecov] | |
| description = [only run on CI]: upload coverage data to codecov (depends on coverage running first) | |
| deps = codecov | |
| skip_install = True | |
| commands = python -m codecov --file {toxworkdir}/coverage.xml | |
| [testenv:dev] | |
| description = DEV environment | |
| usedevelop = True | |
| deps = {[testenv]deps} | |
| pip | |
| commands = python -m pip list --format=columns | |
| python -c 'import sys; print(sys.executable)' | |
| [coverage:run] | |
| source = dateutil | |
| [coverage:report] | |
| skip_covered = True | |
| show_missing = True | |
| [testenv:precommit] | |
| description = Run the pre-commit hooks on all files | |
| passenv = | |
| PRE_COMMIT* | |
| deps = | |
| pre-commit | |
| commands = | |
| pre-commit install -f --install-hooks | |
| pre-commit run --all-files | |
| [testenv:tz-{fat,slim,vanguard,rearguard}] | |
| # These clone the tz repository and build it in the environment's temporary | |
| # directory, so they need network access, git, make and a C compiler. | |
| # | |
| # tz-fat and tz-slim use the main data form, compiled with `zic -b fat` or | |
| # `zic -b slim`; tz-vanguard and tz-rearguard use those data forms, compiled | |
| # with zic's default, `-b slim`. | |
| description = Run the tests against the master of the tz database | |
| basepython = python3.13 | |
| deps = -r {toxinidir}/requirements-dev.txt | |
| setenv = | |
| {[testenv]setenv} | |
| PYTHONTZPATH = {envtmpdir}/tzdir/usr/share/zoneinfo | |
| TZDIR = {envtmpdir}/tzdir/usr/share/zoneinfo | |
| fat: TZ_BLOAT = fat | |
| slim,vanguard,rearguard: TZ_BLOAT = slim | |
| fat,slim: TZ_DATAFORM = main | |
| vanguard: TZ_DATAFORM = vanguard | |
| rearguard: TZ_DATAFORM = rearguard | |
| passenv = TZ | |
| changedir = {toxworkdir} | |
| allowlist_externals = | |
| {toxinidir}/ci_tools/run_tz_master_env.sh | |
| commands = | |
| {toxinidir}/ci_tools/run_tz_master_env.sh {envtmpdir} {toxinidir} | |
| [testenv:docs] | |
| description = invoke sphinx-build to build the HTML docs, check that URIs are valid | |
| basepython = python3.13 | |
| deps = -r docs/requirements-docs.txt | |
| {[testenv]deps} | |
| commands = python -m sphinx -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" {posargs:-W --color -bhtml} | |
| python -m sphinx -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" {posargs:-W --color -blinkcheck} | |
| [testenv:news] | |
| description = Invoke towncrier to update the NEWS file | |
| basepython = python3.11 | |
| passenv = * | |
| deps = towncrier | |
| commands = | |
| towncrier {posargs} | |
| [testenv:build] | |
| description = Build an sdist and bdist | |
| skip_install = true | |
| passenv = * | |
| deps = build[uv] >= 1.2.0 | |
| twine | |
| commands = | |
| python -m build --installer uv --outdir dist . | |
| python -m twine check --strict dist/* |