-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathtox.ini
More file actions
68 lines (63 loc) · 2.61 KB
/
tox.ini
File metadata and controls
68 lines (63 loc) · 2.61 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
# 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 = py{39,310,311,312,313,py3}-test, flake8, mypy, docs, pkg
isolated_build = true
skip_missing_interpreters=True
[testenv]
# Let Poetry installs all the dependencies and the current package in editable mode
skip_install = true
allowlist_externals = poetry
description =
test: Run tests
flake8: Run static analysis
mypy: Run type analysis
docs: Generate documentation
pkg: Build the package
changedir =
docs: docs
setenv =
test: INSTALL_OPTS=--with test
flake8: INSTALL_OPTS=--with flake8
mypy: INSTALL_OPTS=--with mypy
docs: INSTALL_OPTS=--with docs
pkg: INSTALL_OPTS=
commands_pre =
poetry run python --version
poetry run python -c "import platform; print(platform.architecture())"
commands =
poetry sync {env:INSTALL_OPTS}
test: poetry run pytest --junit-xml=junit/{envname}.xml --junit-prefix={envname} {posargs: -m "not integration"}
flake8: poetry run flake8 {posargs}
mypy: poetry run mypy nixnet nixnet_examples tests {posargs}
docs: poetry run sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html {posargs}
pkg: poetry build
# Only pypy3-test will be executed in pypy3.9-7.3.9 Travis CI job, and it needs customized commands
[testenv:pypy3-test]
commands =
# poetry export to a requirements.txt file is used as a workaround since `poetry install / sync`
# would raise an AsssertionError from cpyext (CPython compatibility layer) when using
# pypy3.9-7.3.9 in Ubuntu Jammy
poetry export {env:INSTALL_OPTS} --without-hashes -f requirements.txt --output requirements.txt
poetry run pip install -r requirements.txt
poetry run pip install --no-deps -e .
poetry run pytest --junit-xml=junit/{envname}.xml --junit-prefix={envname} {posargs: -m "not integration"}
[flake8]
show_source = true
# We recommend setting your editor's visual guide to 79 but allow overflow to
# 120 for readability in certain cases
max_line_length = 120
exclude = build,docs,.tox,__pycache__
# W503: Line break occurred before a binary operator
ignore = W503
[pytest]
addopts = --ignore docs/ --cov nixnet --cov nixnet_examples --cov-report term --cov-report xml --verbose --doctest-modules
markers =
integration: Integration test.
# Only run flake8, mypy, docs and pkg on Python 3.9 in Travis CI, and only run the tests for the
# other Python versions
[travis]
python =
3.9: py39-test, flake8, mypy, docs, pkg