-
Notifications
You must be signed in to change notification settings - Fork 13
/
tox.ini
63 lines (60 loc) · 2.52 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
[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}
[testenv]
allowlist_externals =
python
micromamba
bcal
dot
bash
rolldice
which
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"
[testenv:pep8]
description = verify pep8
deps = ruff
commands = ruff check .
[testenv:py3{10,11,12}{,-conda}]
description = run pytest
skip_install = false
extras = 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}