summaryrefslogtreecommitdiff
path: root/tox.ini
blob: 0a28fd0de6c21b2a4eb4fdadcd1d919e829cf15e (plain)
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
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist =
    flake8, mypy, py37, py38, py39, py310, py311
# Other valid environments are:
#   docs
#   release
#   clean
#   bump

# Don't error out if a user hasn't installed all python versions.
skip_missing_interpreters =
    true

[testenv]
passenv =
    WITH_EXTRAS
deps =
    coverage
    pytest
    pytest-cov
    pytest-mock
    hypothesis
extras =
    {env:WITH_EXTRAS:}
commands =
    # Doctests
    {envpython} -m doctest -o IGNORE_EXCEPTION_DETAIL docs/howitworks.rst
    pytest README.rst docs/examples.rst
    pytest --doctest-modules {envsitepackagesdir}/natsort
    # Full test suite. Allow the user to pass command-line objects.
    pytest --hypothesis-profile=slow-tests --tb=short --cov {envsitepackagesdir}/natsort --cov-report term-missing {posargs:}

# Check code quality.
[testenv:flake8]
deps =
    flake8
    flake8-import-order
    flake8-bugbear
    pep8-naming
    check-manifest
    twine
commands =
    {envpython} setup.py sdist
    pip wheel . -w dist
    flake8
    check-manifest --ignore ".github*,*.md,.coveragerc"
    twine check dist/*
skip_install = true

# Type checking
[testenv:mypy]
deps =
    mypy
    hypothesis
    pytest
    pytest-mock
    fastnumbers>=5.0.1
    typing_extensions
commands =
    mypy --strict natsort tests
skip_install = true

# Build documentation.
# sphinx and sphinx_rtd_theme not in docs/requirements.txt because they
# will already be installed on readthedocs.
[testenv:docs]
deps =
    sphinx
    sphinx_rtd_theme
commands =
    {envpython} setup.py build_sphinx
skip_install = true

# Bump version
[testenv:bump]
passenv =
    HOME
deps =
    bump2version
commands =
    {envpython} dev/bump.py {posargs:}
skip_install = true

# Release the code to PyPI
[testenv:release]
deps =
    twine
commands =
    {envpython} setup.py sdist --format=gztar bdist_wheel
    twine upload --skip-existing dist/*
skip_install = true

# Clean up the working directory
[testenv:clean]
deps =
commands = {envpython} dev/clean.py
skip_install = true

# Get GitHub actions to run the correct tox environment
[gh-actions]
python =
    3.7: py37
    3.8: py38
    3.9: py39
    3.10: py310
    3.11: py311