-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
136 lines (117 loc) · 4.69 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
[tox]
min_version = 3.4
requires = tox-extras ~= 0.0.1
# `tox_extras =` will install dependencies without the main package based on extras defined in pyproject.toml
suicide_timeout = 0.1
interrupt_timeout = 0.4
terminate_timeout = 0.5
skip_missing_interpreters = true
# env_list defines the default environments to run with tox's legacy command (`tox` or `tox -p`)
env_list = main, py3{7,8,9,10,11}, awaitpy, metadata, package
labels =
test = main
testall = main, py3{7,8,9,10,11}
docs = docs
metadata = metadata
package = package, testpackage
testpackage = testpackage
prepare = main, py3{7,8,9,10,11}, awaitpy, docs, metadata, package, testpackage
clean = clean
testpublish = testpublish-noparallel
publish = publish-noparallel
# Each label is associated with one or more environments to run.
# Each extras defined in pyproject.toml should have one label matching it
# There can be additional labels, for tasks without any package dependencies
# Tox should be run by specifying labels, and not environments directly:
# `tox r -m <label>` or `tox run -m <label>`
# `tox p -m <label>` or `tox run-parallel -m <label>`
[testenv]
# Tests that require installing the package; default
skip_install = false
no_package = false
[task]
# Additional tasks that work on other files and do not require installing the package
skip_install = true
no_package = true
[await]
# No-op for syncing dependencies
skip_install = true
no_package = true
ignore_outcome = true
[testenv:main]
description = Test in the locally installed Python version (writes to main directory)
tox_extras = test
commands =
coverage run -m pytest
coverage report --fail-under=80
coverage html
[testenv:py3{7,8,9,10,11}]
description = Test different Python versions
tox_extras = test
commands =
coverage run --data-file={env_dir}/.coverage -m pytest
coverage report --data-file={env_dir}/.coverage --fail-under=80
[testenv:awaitpy]
description = Consolidate tests for different Python versions
depends = main, py3{7,8,9,10,11}
base = await
[testenv:docs]
description = Generate documentation
depends = awaitpy
base = task
tox_extras = docs
allowlist_externals = rm, find
commands_pre = rm -rf docs/html/
commands = pdoc src/gpath -o docs/html -t docs/templates --favicon favicon.png --edit-url gpath='https://github.com/yushiyangk/GPath/blob/main/src/gpath/'
commands_post = find docs/html -type d -exec cp docs/templates/favicon.png "{}" ";"
parallel_show_output = true
[testenv:metadata]
description = Check package metadata
depends = awaitpy
base = task
tox_extras = metadata
commands = pyroma .
parallel_show_output = true
[testenv:package]
description = Generate packages (writes to main directory)
depends = awaitpy, metadata, docs
base = task
tox_extras = package
allowlist_externals = rm
commands_pre = rm -rf dist/ generic_path.egg-info/
commands = python -m build
commands_post = rm -rf generic_path.egg-info/
[testenv:testpackage]
description = Check packages
depends = package
base = task
tox_extras = packagetest
commands = twine check dist/*
parallel_show_output = true
# Non-default tasks are given below.
# Some of them are probably very dangerous.
[testenv:clean]
description = Remove all artefacts
base = task
allowlist_externals = rm
commands = rm -rf .coverage htmlcov/ build/ dist/ docs/html/ generic_path.egg-info/
[testenv:testpublish-noparallel]
description = Publish package to TestPyPI (WARNING: this can only be done once without changing the version number)
depends = packagetest
base = task
tox_extras = publish
commands_pre =
python -c 'print("This task cannot be run in parallel mode.")'
python -c 'import itertools as i; from os import linesep as n; s="Confirm? [y/N] "; p=i.chain(["Publishing to TestPyPI:"+n+" Warning: this cannot be overwritten and cannot be undone."+n+s],i.repeat(s)); r=next(filter(lambda x:not x or x[0] in "yn",map(str.lower,map(str.strip,map(input,p))))); exit(r!="y")' # Confirmation prompt
commands = twine upload -r testpypi dist/*
ignore_errors = false
parallel_show_output = true
[testenv:publish-noparallel]
description = Publish package to PyPI (WARNING: this can only be done once without changing the version number)
depends = packagetest
base = task
tox_extras = publish
commands_pre = python -c 'import itertools as i; from os import linesep as n; s="Confirm? [y/N] "; p=i.chain(["Publishing to PyPI:"+n+" Warning: this cannot be overwritten and cannot be undone."+n+s],i.repeat(s)); r=next(filter(lambda x:not x or x[0] in "yn",map(str.lower,map(str.strip,map(input,p))))); exit(r!="y")' # Confirmation prompt
commands = twine upload dist/*
ignore_errors = false
parallel_show_output = true