summaryrefslogtreecommitdiffstats
path: root/tox.ini
blob: 0c0bec0900189408cbb8b9cfcef910243af57785 (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
[tox]
minversion = 3.16.1
envlist =
    linters
    docs
    packaging
    py{36,37,38,39,310}
isolated_build = true
requires =
  setuptools >= 41.4.0
  pip >= 19.3.0
skip_missing_interpreters = False

[testenv]
description = Unittest using {basepython}
commands =
    /bin/bash -c 'pytest _test/test_*.py'
deps =
    pytest
allowlist_externals =
    make
    sh

[testenv:docs]
description = Build docs
basepython = python3.8
deps =
    --editable .[docs]
commands =
    make singlehtml
changedir = {toxinidir}/_doc

[testenv:linters]
description = Linting
basepython = python3.8
deps =
    pre-commit>=2.8.2
    flake8
    flake8-bugbear
commands =
    pre-commit run -a

[testenv:packaging]
description =
    Do packaging/distribution
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
# don't install package itself in this env
skip_install = true
deps =
  build >= 0.7.0
  twine >= 3.7.0
setenv =
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 --force-reinstall {toxinidir}/dist/*.whl"