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