xref: /aosp_15_r20/external/fonttools/tox.ini (revision e1fe3e4ad2793916b15cccdc4a7da52a7e1dd0e9)
1*e1fe3e4aSElliott Hughes[tox]
2*e1fe3e4aSElliott Hughesminversion = 3.0
3*e1fe3e4aSElliott Hughesenvlist = lint, py3{8,9,10,11,12}-cov, htmlcov
4*e1fe3e4aSElliott Hughesskip_missing_interpreters=true
5*e1fe3e4aSElliott Hughes
6*e1fe3e4aSElliott Hughes[testenv]
7*e1fe3e4aSElliott Hughessetenv =
8*e1fe3e4aSElliott Hughes    cy: FONTTOOLS_WITH_CYTHON=1
9*e1fe3e4aSElliott Hughes# use 'download = true' to have tox install the latest pip inside the virtualenv.
10*e1fe3e4aSElliott Hughes# We need this to be able to install skia-pathops on Linux, which uses a
11*e1fe3e4aSElliott Hughes# relatively recent 'manylinux2014' platform tag.
12*e1fe3e4aSElliott Hughes# https://github.com/tox-dev/tox/issues/791#issuecomment-518713438
13*e1fe3e4aSElliott Hughesdownload = true
14*e1fe3e4aSElliott Hughes# building lxml from source takes too long on CI, force it to download pre-compiled
15*e1fe3e4aSElliott Hughes# wheel or fail if none is found with --only-binary=lxml
16*e1fe3e4aSElliott Hughesinstall_command = python -m pip install --only-binary=lxml {opts} {packages}
17*e1fe3e4aSElliott Hughesdeps =
18*e1fe3e4aSElliott Hughes    cov: coverage>=4.3
19*e1fe3e4aSElliott Hughes    pytest>=7.0.0
20*e1fe3e4aSElliott Hughes    pytest-randomly
21*e1fe3e4aSElliott Hughes    # add -noextra to tox -e to skip installing extras and only test the core fonttools
22*e1fe3e4aSElliott Hughes    !noextra: -rrequirements.txt
23*e1fe3e4aSElliott Hughescommands =
24*e1fe3e4aSElliott Hughes    cy: python -c "from fontTools.cu2qu.cu2qu import COMPILED; assert COMPILED"
25*e1fe3e4aSElliott Hughes    !cy: python -c "from fontTools.cu2qu.cu2qu import COMPILED; assert not COMPILED"
26*e1fe3e4aSElliott Hughes    # test with or without coverage, passing extra positonal args to pytest
27*e1fe3e4aSElliott Hughes    cov: coverage run --parallel-mode -m pytest {posargs}
28*e1fe3e4aSElliott Hughes    !cov: pytest {posargs:Tests fontTools}
29*e1fe3e4aSElliott Hughes
30*e1fe3e4aSElliott Hughes[testenv:htmlcov]
31*e1fe3e4aSElliott Hughesdeps =
32*e1fe3e4aSElliott Hughes    coverage>=4.3
33*e1fe3e4aSElliott Hughesskip_install = true
34*e1fe3e4aSElliott Hughescommands =
35*e1fe3e4aSElliott Hughes    coverage combine
36*e1fe3e4aSElliott Hughes    coverage html
37*e1fe3e4aSElliott Hughes
38*e1fe3e4aSElliott Hughes[testenv:lint]
39*e1fe3e4aSElliott Hughesdeps =
40*e1fe3e4aSElliott Hughes    -r dev-requirements.txt
41*e1fe3e4aSElliott Hughesskip_install = true
42*e1fe3e4aSElliott Hughescommands =
43*e1fe3e4aSElliott Hughes    black --check --diff .
44*e1fe3e4aSElliott Hughes    mypy
45*e1fe3e4aSElliott Hughes
46*e1fe3e4aSElliott Hughes[testenv:codecov]
47*e1fe3e4aSElliott Hughespassenv = *
48*e1fe3e4aSElliott Hughesdeps =
49*e1fe3e4aSElliott Hughes    coverage>=4.3
50*e1fe3e4aSElliott Hughes    codecov
51*e1fe3e4aSElliott Hughesskip_install = true
52*e1fe3e4aSElliott Hughesignore_outcome = true
53*e1fe3e4aSElliott Hughescommands =
54*e1fe3e4aSElliott Hughes    coverage combine
55*e1fe3e4aSElliott Hughes    codecov --env TOXENV
56*e1fe3e4aSElliott Hughes
57*e1fe3e4aSElliott Hughes[testenv:package_readme]
58*e1fe3e4aSElliott Hughesdescription = check that the long description is valid (need for PyPi)
59*e1fe3e4aSElliott Hughesdeps = twine >= 1.12.1
60*e1fe3e4aSElliott Hughes       pip >= 18.0.0
61*e1fe3e4aSElliott Hughesskip_install = true
62*e1fe3e4aSElliott Hughesextras =
63*e1fe3e4aSElliott Hughescommands = pip wheel -w {envtmpdir}/build --no-deps .
64*e1fe3e4aSElliott Hughes           twine check {envtmpdir}/build/*
65*e1fe3e4aSElliott Hughes
66*e1fe3e4aSElliott Hughes[testenv:bdist]
67*e1fe3e4aSElliott Hughesdeps =
68*e1fe3e4aSElliott Hughes    setuptools
69*e1fe3e4aSElliott Hughes    wheel
70*e1fe3e4aSElliott Hughesskip_install = true
71*e1fe3e4aSElliott Hughesinstall_command =
72*e1fe3e4aSElliott Hughes    # make sure we use the latest setuptools and wheel
73*e1fe3e4aSElliott Hughes    pip install --upgrade {opts} {packages}
74*e1fe3e4aSElliott Hugheswhitelist_externals =
75*e1fe3e4aSElliott Hughes    rm
76*e1fe3e4aSElliott Hughescommands =
77*e1fe3e4aSElliott Hughes    # clean up build/ and dist/ folders
78*e1fe3e4aSElliott Hughes    python -c 'import shutil; shutil.rmtree("dist", ignore_errors=True)'
79*e1fe3e4aSElliott Hughes    python setup.py clean --all
80*e1fe3e4aSElliott Hughes    # build sdist
81*e1fe3e4aSElliott Hughes    python setup.py sdist --dist-dir {toxinidir}/dist
82*e1fe3e4aSElliott Hughes    # build wheel from sdist
83*e1fe3e4aSElliott Hughes    pip wheel -v --no-deps --no-index --wheel-dir {toxinidir}/dist --find-links {toxinidir}/dist fonttools
84*e1fe3e4aSElliott Hughes
85*e1fe3e4aSElliott Hughes[testenv:pypi]
86*e1fe3e4aSElliott Hughesdeps =
87*e1fe3e4aSElliott Hughes    {[testenv:bdist]deps}
88*e1fe3e4aSElliott Hughes    twine
89*e1fe3e4aSElliott Hughesskip_install = true
90*e1fe3e4aSElliott Hughespassenv = TWINE_USERNAME TWINE_PASSWORD
91*e1fe3e4aSElliott Hughescommands =
92*e1fe3e4aSElliott Hughes    {[testenv:bdist]commands}
93*e1fe3e4aSElliott Hughes    twine upload dist/*.whl dist/*.zip
94