-
Notifications
You must be signed in to change notification settings - Fork 6
/
tox.ini
112 lines (102 loc) · 3.49 KB
/
tox.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# tox.ini file for Tox https://tox.wiki/en/latest/config.html
# To perform the same tests done in GitHub Actions by CI-CD but locally (i.e. before pushing), run $ tox --parallel
# At its core tox provides a convenient way to run arbitrary commands in isolated environments to serve as a single
# entry point for build, test and release activities.
# May be run in parallel:
# > tox -p # TODO: this can be unreliable
[tox]
requires =
tox>=4.15.0
virtualenv>=20.26.2
env_list =
pre-commit
py{313,310}-new-install # We install it for the current and lowest version we support
py{313,312,311,310}-pytest
post
docs
# Packaging is required for parallel testing
skip_missing_interpreters = true
[testenv]
# Settings defined here are automatically inherited by individual environments unless overridden
pass_env =
REDIS_URI
TELEGRAM_TOKEN
set_env =
PRE_COMMIT_COLOR = always
PYTEST_ADDOPTS = --color=yes
PYTHONPATH = {toxinidir}
PYTHONUTF8 = 1
USERPROFILE = {env:TEMP}
# TODO The command below works in Windows only
WEBCHANGES_BROWSER_PATH = C:\Program Files\Google\Chrome\Application\chrome.exe
parallel_show_output = true
[testenv:pre-commit]
# Settings defined in the top-level testenv section are automatically inherited if not overwritten
deps =
-rtests/requirements_pre-commit.txt
-rdocs/requirements.txt
temp_dir = {work_dir}/.tmp_pre-commit
skip_install = true
allowlist_externals =
pre-commit
description = Run pre-commit
commands =
pre-commit run -a
[testenv:new-install]
# Settings defined in the top-level testenv section are automatically inherited if not overwritten
# Empty values are to remove (override) top level
deps =
build
description = Emulate a new installation using wheel, ensuring e.g. that all packages are installed
commands =
pip install --upgrade pip build wheel
python -m build -w
pip install --upgrade --find-links={toxinidir}\dist webchanges
python -m webchanges.cli --help
# python -c "from pathlib import Path; dir = Path.home().joinpath('Documents').joinpath('webchanges'); [f.unlink() for f in dir.iterdir()]; dir.rmdir()"
[testenv:pytest]
# Settings defined in the top-level testenv section are automatically inherited if not overwritten
deps =
-rrequirements.txt
-rtests/requirements_pytest.txt
-rdocs/requirements.txt
depends =
pre-commit
new-install
description = Run tests
commands =
# TODO as of feb-23 crashes with Windows fatal exception: access violation
# coverage run --parallel-mode
# coverage run
python -m pytest -v --cov=./ --cov-report=term --cov-report=xml tests/
; python -m pytest
[testenv:post]
description = Post-tests cleanup for coverage
depends =
py{313,312,311,310}-pytest
skip_install = true
deps =
coverage
coverage-conditional-plugin
commands =
coverage combine
# TODO The command below works in Windows only
coverage html
cmd /c if %errorlevel% equ 0 start "" "file://{toxinidir}/post/htmlcov/index.html"
allowlist_externals =
cmd
[testenv:docs]
description = Docs build
skip_install = true
# We run in Python 3.12 to match the default image https://docs.readthedocs.io/en/stable/config-file/v2.html
base_python = python3.12
deps =
-rrequirements.txt
-rdocs/requirements.txt
commands =
sphinx-build -W -j auto docs docs/_build
# TODO The command below works in Windows only
cmd /c if %errorlevel% equ 0 start "" "file://{toxinidir}/docs/_build/index.html"
allowlist_externals =
cmd
sphinx-build