-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtox.ini
More file actions
127 lines (110 loc) · 3.53 KB
/
tox.ini
File metadata and controls
127 lines (110 loc) · 3.53 KB
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
# Can be run through "tox.sh" for convenience
[tox]
# Required for `tox -p auto` to work; here's the commit we're after:
# https://github.com/tox-dev/tox/pull/1202
minversion = 3.8.0
build_version = 1.2.2.post1
mypy_version = 1.15.0
ruff_version = 0.10.0
pytest_version = 8.3.5
envlist=
ruff-format
mypy
ruff-check
shellcheck
installtest
pytest
package, test-package
test-wheel
test-build-from-clean-clone
[testenv]
basepython = python3
allowlist_externals = /bin/bash
[testenv:ruff-format]
skip_install = true
deps =
ruff=={[tox]ruff_version}
# Format locally, check in CI and fail on not-formatted code
commands = /bin/bash -c 'if [ "{env:CI:}" ] ; then CHECK="--check --diff" ; fi ; ruff format $CHECK'
[testenv:mypy]
# NOTE: In theory mypy should probably depend on ruff-format to get line numbers
# in any error messages right. But since mypy tends to finish last, and being a
# bit off isn't the end of the world, let's not depend on ruff-format for now
# and hope nobody notices.
deps =
mypy=={[tox]mypy_version}
pytest=={[tox]pytest_version}
types-python-dateutil==2.8.19
commands =
/bin/bash -c 'mypy --pretty .'
[testenv:ruff-check]
skip_install = true
# Depend on ruff-format to not complain about formatting errors
depends = ruff-format
deps =
ruff=={[tox]ruff_version}
pytest=={[tox]pytest_version}
# Auto-fix locally but not in CI
commands =
/bin/bash -c 'FIX="--fix" ; if [ "{env:CI:}" ] ; then FIX="--no-fix" ; fi ; ruff check $FIX'
[testenv:shellcheck]
skip_install = true
commands =
/bin/bash -c 'shellcheck ./*.sh ./*/*.sh'
[testenv:installtest]
allowlist_externals = {toxinidir}/tests/installtest.sh
commands =
{toxinidir}/tests/installtest.sh
[testenv:pytest]
depends = ruff-format
deps =
pytest == {[tox]pytest_version}
pytest-avoidance == 0.3.0
python-dateutil >= 2.6.1
commands =
pytest --durations=10 --color=yes tests
[testenv:package]
# Create {toxinidir}/px.pex
depends = ruff-format
allowlist_externals = {toxinidir}/devbin/make-executable-zip.sh
deps =
# Used by the make-executable-zip.sh script
virtualenv
commands =
{toxinidir}/devbin/make-executable-zip.sh
[testenv:test-package]
depends = package
commands =
# Verify we have the correct shebang
/bin/bash -c 'head -n1 {toxinidir}/px.pex | grep -Eq "^\#!/usr/bin/env python3$"'
# Test that there are no natively compiled dependencies. They make
# distribution a lot harder. If this triggers, fix your dependencies!
/bin/bash -c '! unzip -qq -l "{toxinidir}/px.pex" "*.so"'
# Run pex and ensure it doesn't fail
python -Werror {toxinidir}/px.pex
# Test version string vs git
/bin/bash -x -c '[[ "$("{toxinidir}/px.pex" --version)" =~ ^"$(git describe | cut -f1,2 -d.)" ]]'
[testenv:test-wheel]
# Test installing using pip
depends = ruff-format
allowlist_externals =
/bin/bash
/bin/rm
deps =
build == {[tox]build_version}
commands =
# clean up build/ and dist/ folders
/bin/rm -rf build dist
# build wheel, must match the test in test_clone_and_build.py
python -m build --outdir {toxinidir}/dist
# Start testing it
/bin/bash -c "pip uninstall --yes pxpx"
/bin/bash -c "pip install {toxinidir}/dist/pxpx-*.whl"
# Verify we can run the px we just installed using pip
px tox
# Test version string vs git
/bin/bash -x -c '[[ "$(px --version)" =~ ^"$(git describe | cut -f1,2 -d.)" ]]'
[testenv:test-build-from-clean-clone]
deps =
build == {[tox]build_version}
commands = python3 {toxinidir}/devbin/test_clone_and_build.py