This repository has been archived by the owner on Jun 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
115 lines (110 loc) · 3.24 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
# Tox configuration file
# Read more under https://tox.wiki/
# THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS!
[tox]
minversion = 4.6.3
envlist =
pkg
lint
py
isolated_build = true
requires =
tox >= 4.6.3
setuptools >= 65.3.0 # editable installs
[testenv]
description = Invoke pytest to run automated tests
setenv =
TOXINIDIR = {toxinidir}
passenv =
GH_TOKEN
GITHUB_TOKEN
HOME
TERM
PYTHON*
PYTEST_*
PY_COLORS
SETUPTOOLS_*
LANG
LC_*
extras =
test
commands =
coverage run -m pytest {posargs}
coverage xml
coverage report
package = editable
allowlist_externals =
gh
sh
[testenv:{build,clean}]
description =
build: Build the package in isolation according to PEP517, see https://github.com/pypa/build
clean: Remove old distribution files and temporary build artifacts (./build and ./dist)
# https://setuptools.pypa.io/en/stable/build_meta.html#how-to-use-it
skip_install = True
changedir = {toxinidir}
deps =
build: build[virtualenv]
passenv =
SETUPTOOLS_*
commands =
clean: python -c 'import shutil; [shutil.rmtree(p, True) for p in ("build", "dist", "docs/_build")]'
clean: python -c 'import pathlib, shutil; [shutil.rmtree(p, True) for p in pathlib.Path("src").glob("*.egg-info")]'
build: python -m build {posargs}
# By default, both `sdist` and `wheel` are built. If your sdist is too big or you don't want
# to make it available, consider running: `tox -e build -- --wheel`
[testenv:lint]
description = Run all linters
# pip compile includes python version in output constraints, so we want to
# be sure that version does not change randomly.
basepython = python3.10
deps =
pre-commit>=2.6.0
setuptools>=51.1.1
pytest>=7.2.2 # to updated schemas
skip_install = true
commands_pre =
commands =
{envpython} -m pre_commit run --all-files --show-diff-on-failure {posargs:}
passenv =
{[testenv]passenv}
PRE_COMMIT_HOME
setenv =
{[testenv]setenv}
# avoid messing pre-commit with out own constraints
PIP_CONSTRAINT=
[testenv:pkg]
description =
Do packaging/distribution. If tag is not present or PEP440 compliant upload to
PYPI could fail
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
# don't install molecule itself in this env
skip_install = true
deps =
build >= 0.9.0
twine >= 4.0.1
pipx
commands =
# 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 "gh-pre @ file://$(echo {toxinidir}/dist/*.whl)"'
# call the tool
sh -c "HOME=tests python3 -m gh_pre --help"
# Uninstall it
python3 -m pip uninstall -y gh-pre
# Testing pipx compatibility
pipx install --verbose --editable .
sh -c "pipx list --short | grep gh-pre"
# Testing gh calling
sh -c "gh extension remove gh-pre || true"
gh extension install .
gh pre --help --config=tests/pre.yml