-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtox.ini
More file actions
89 lines (85 loc) · 3.31 KB
/
tox.ini
File metadata and controls
89 lines (85 loc) · 3.31 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
[tox]
envlist =
pep8
py3{10,11,12}
py3{10,11,12}-inputs-{linux,macos,windows,conda,con_da}
default_python
py{,py}3{10,13}-python_version
libraries
cache-{setup,verify}
covcheck
[testenv]
allowlist_externals =
python
micromamba
bcal
dot
bash
rolldice
which
dependency_groups =
covcheck: covcheck
covcheck: test
skip_install = true
passenv = MY_VAR
commands =
# Check the python version is as expected
python -c "import sys; assert sys.version_info.major == 3"
py310: python -c "import sys; assert sys.version_info.minor == 10"
py311: python -c "import sys; assert sys.version_info.minor == 11"
pypy311: python -c "import sys; assert sys.version_info.minor == 11"
py312: python -c "import sys; assert sys.version_info.minor == 12"
py313: python -c "import sys; assert sys.version_info.minor == 13"
default_python: python -c "import sys; assert sys.version_info.minor == {posargs}"
python_version: python -c "import platform; assert platform.python_implementation() == '{posargs}'"
# Check the OS is as expected
linux: python -c "import platform; assert platform.system() == 'Linux'"
macos: python -c "import platform; assert platform.system() == 'Darwin'"
windows: python -c "import platform; assert platform.system() == 'Windows'"
# Check is conda is being used
!conda-!con_da: python -c "import os, sys; assert not os.path.exists(os.path.join(sys.prefix, 'conda-meta', 'history'))"
conda,con_da: python -c "import os, sys; assert {posargs} os.path.exists(os.path.join(sys.prefix, 'conda-meta', 'history'))"
# Run a command that should only succeed is the library is installed
libraries: {posargs}
# Verify that setenv is working
setenv-global: python -c "import os; assert os.environ['MY_VAR'] == 'global_value'"
setenv-local: python -c "import os; assert os.environ['MY_VAR'] == 'local_value'"
# Verify that caching is working
cache-verify: python -c "f = open('a/b/c/test.txt', 'r'); f.close()"
cache-setup: python -c "import os; os.makedirs('a/b/c/'); f = open('a/b/c/test.txt', 'w'); f.close()"
# Verify that artifact uploads are working
artifact-upload: bash -c "echo 'hello world' > test.txt"
# Verify that freethreaded builds are using freethreaded interpreter
py313t: python -c "import sys; assert 'free-threading' in sys.version"
covcheck: coverage run --parallel-mode -m pytest --pyargs test_package {posargs}
[testenv:pep8]
description = verify pep8
deps = ruff
commands = ruff check .
[testenv:py3{10,11,12}{,-conda}]
description = run pytest
skip_install = false
dependency_groups = test
conda_deps = pytest
commands =
conda: python -c "import os, sys; assert os.path.exists(os.path.join(sys.prefix, 'conda-meta', 'history'))"
conda: micromamba list
pytest --pyargs test_package {posargs}
[testenv:build_docs]
changedir = docs
description = Invoke sphinx-build to build the HTML docs
deps =
-r docs/requirements.txt
commands =
pip freeze --all --no-input
sphinx-build \
-j auto \
--color \
-W \
--keep-going \
-b html \
-d _build/.doctrees \
./source \
_build/html \
{posargs}
python -c 'import pathlib; print("Documentation available under file://\{0\}".format(pathlib.Path(r"{toxinidir}") / "docs" / "_build" / "index.html"))'