-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
tox.ini
117 lines (110 loc) · 2.99 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
[tox]
envlist =
lint
packaging
py
# needed by PEP-517 projects:
isolated_build = True
minversion = 4.0.2
requires =
tox>=4.0.2
# temporary disabled due to problem with tox v4
# fail build if git reports dirty after test run
# tox-extra>=1.0.1a0
[testenv]
editable = true
usedevelop = true
extras =
test
commands_pre =
{toxinidir}/tests/tools/create_dummy_box.sh virtualbox
{toxinidir}/tests/tools/create_dummy_box.sh libvirt
sh -c "rm -rf {toxinidir}/.tox/.coverage*"
commands =
coverage run -m pytest {posargs:}
passenv =
COVERAGE*
GITHUB*
PYTHON_*
PYTHON_VAGRANT_TEST_PROVIDER
# Pass HOME to the test environment as it is required by
# vagrant. Otherwise error happens due to missing HOME env variable.
HOME
PYTEST_*
TERM
setenv =
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
PIP_CONSTRAINT = requirements.txt
allowlist_externals =
git
sh
*/create_dummy_box.sh
[testenv:dev]
commands = {posargs}
[testenv:deps]
description = Bump all test dependencies
# we reuse the lint environment
envdir = {toxworkdir}/lint
skip_install = true
deps =
{[testenv:lint]deps}
setenv =
# without his upgrade would likely not do anything
PIP_CONSTRAINT = /dev/null
commands_pre =
commands =
pre-commit run --all-files --show-diff-on-failure --hook-stage manual up
# Update pre-commit hooks
pre-commit autoupdate
# We fail if files are modified at the end
git diff --exit-code
[testenv:lint]
description = Run all linters
deps =
pre-commit>=2.6.0
setenv =
PIP_CONSTRAINT = /dev/null
skip_install = true
commands_pre =
commands =
{envpython} -m pre_commit run --all-files --show-diff-on-failure {posargs:}
[testenv:packaging]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 0.9.0
twine
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands =
# Safety measure to remove library if somehow appears as installed
sh -c "pip uninstall -y python-vagrant 2>/dev/null"
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build \
--outdir {toxinidir}/dist/ \
{toxinidir}
# Validate metadata using twine
twine check --strict {toxinidir}/dist/*
# Install the wheel
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"
# Basic checks
python -c "import sys, pkgutil; sys.exit(0 if pkgutil.find_loader(sys.argv[1]) else 1)" vagrant
# Uninstall the wheel
pip uninstall -y python-vagrant
[testenv:coverage]
description = Combines and displays coverage results
skip_install = true
commands_pre =
commands =
sh -c "coverage combine --append -q .coverage*"
# needed by codecov github actions:
coverage xml
# just for humans running it:
coverage report
deps =
coverage[toml]