-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtox.ini
More file actions
48 lines (39 loc) · 1.77 KB
/
tox.ini
File metadata and controls
48 lines (39 loc) · 1.77 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
[tox]
envlist = py312-{static-analysis,unit-tests,docs},type-check
[testenv]
allowlist_externals = bash, make, mypy, poetry, pytest
# `poetry install -v` is more consistent with everyday use.
# installation of setuptools in the tox env is needed, otherwise poetry installation will fail
skip_install = true
commands_pre = pip install setuptools
poetry install -v
# Use a single env directory for all environments but separate by Python versions.
#
# It could be easier to just say:
#
# envdir = {toxworkdir}/{basepython}
#
# but, since it's hardcoded in Tox, basepython is not set when envdir is being examined,
# therefore, the replacement fails, hence the explicit names.
envdir = {toxinidir}/.tox/py312
# Don't spoil our nice virtualenvs with system packages
system_site_packages = false
# Capture coverage per Python version
setenv = COVERAGE_FILE={envdir}/.coverage
# Pass necessary env vars to let CI and coverage gathering play together nicely
passenv = CI
commands =
static-analysis: poetry run pytest -v -ra --pylint -k 'not test_' {posargs}
unit-tests: poetry run pytest -v -ra --cov=gluetool --cov-report=html:{envdir}/coverage-report {posargs}
docs: poetry run make -C docs html
[testenv:type-check]
envdir = {toxinidir}/.tox/type-check
basepython = python3.12
skip_install = true
setenv =
MYPATH = {toxinidir}
# Adding `--no-warn-unused-ignores` - `HTTPConnection.debuglevel` is not publicly available in Python 3,
# but mypy does not let us use conditional ignore, therefore it complains about the ignore when being
# checked in `--py2` mode (because in Python 2, the attribute does exist & the ignore is pointless).
# I don't see a way out of it :/
commands = mypy --config-file {toxinidir}/mypy.ini --strict --no-warn-unused-ignores {toxinidir}/gluetool/ {posargs}