-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox-test.ini
84 lines (76 loc) · 3.11 KB
/
tox-test.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[tox]
# pyenv versions
# pyenv install --list
# pyenv global 3.9.16 3.10.14 3.11.9 3.12.4 pypy3.10-7.3.16
# echo "$(pyenv versions --bare)" > {toxworkdir}{/}.python-version
#
# rm -rf ./build; mkdir ./build; cd .tox && tox -r --root=.. -c ../tox-test.ini -e 3.9-linux --workdir=.; cd - &>/dev/null
# rm -rf ./build; mkdir ./build; cd .tox && tox -r --root=.. -c ../tox-test.ini -e pypy-3.9-linux --workdir=.; cd - &>/dev/null
# tox -c tox-test.ini -e py39
# pypy3.10-7.3.16 requires Rust package manager, Cargo. (7161KB --> 22MB installed)
# sudo xbps-install -S --yes cargo
env_list = py{py39,py310,39,310,311,312,313}-{linux,macos,windows}
toxworkdir = {env:TOXWORKDIR:.tox}
skip_missing_interpreters = true
[gh-actions]
# `PYVERSIONS <https://pypi.org/project/tox-gh/>`_
# `Example with pypy3.10 <https://github.com/celery/kombu/blob/main/tox.ini>`_
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313
pypy3-9: pypy39
pypy3-10: pypy310
[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
[testenv]
description = Run coverage
extras =
toml
allowlist_externals =
pytest
coverage
echo
usedevelop = False
download = True
deps =
-r requirements/pip.lock
-r requirements/dev.lock
build
passenv = *
# https://www.topbug.net/blog/2020/12/19/platform-dependent-python-coverage-test-with-tox/
# `COVERAGE_PROCESS_START <https://hynek.me/articles/turbo-charge-tox/#manual>`_
# py{py39,py310,39,310,311,312,313}: COVERAGE_FILE = .coverage.{envname}
setenv =
#PYTHONWARNINGS=ignore:removed in Python 3.14; use ast.Constant:DeprecationWarning
# Disable CPython's color output
PYTHON_COLORS=0
TOXINIDIR = {toxinidir}
DS_CONFIG_SETTINGS={temp_dir}/setuptools-build.toml
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
# tox not recognizing config_settings passed via cli
# python -m build -C--kind="[tag | current]"
#
# add `cov.pth <https://hynek.me/articles/turbo-charge-tox/#manual>`_
# to inform coverage about subprocess
commands_pre =
{envpython} -c 'from pathlib import Path; txt="[project]\nname = \"whatever\"\nversion = \"0.0.1\"\n\n[tool.config-settings]\nkind=\"tag\"\n"; p=Path("{env:DS_CONFIG_SETTINGS}"); p.write_text(txt)'
{envpython} -c 'from pathlib import Path; Path("{env_site_packages_dir}/cov.pth").write_text("import coverage; coverage.process_startup()")'
# {posargs:-vv} --cov-report=term-missing --showlocals tests
# pytest --cov=drain_swamp --cov-append --cov-report=term-missing tests
# https://github.com/nedbat/coveragepy/issues/1514
# https://pytest-cov.readthedocs.io/en/latest/tox.html
# https://github.com/pytest-dev/pytest-cov/blob/master/examples/src-layout/tox.ini
commands =
-coverage combine --data-file=.coverage.{envname}
-coverage erase --data-file=.coverage.{envname}
python -m build
python -m pip install --disable-pip-version-check -q .
python -m coverage run --data-file=.coverage.{envname} --parallel -m pytest --showlocals -vv {posargs} tests
- coverage combine --data-file=.coverage.{envname}
coverage report --data-file=.coverage.{envname} --fail-under=93