forked from arvidn/libtorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
48 lines (46 loc) · 2.27 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
[tox]
envlist = py36,py37,py38,py39
[testenv]
# Passing all environment variables is not the best thing for isolation, but
# seems to be expected for building native code. In particular, I can't easily
# read boost's msvc.jam to figure out what to pass to configure msvc-14.2 on
# windows. If we discover problems with this, consider restricting passenv with
# platform-specific testenvs.
passenv = *
# tox's "real" support for installing bdists instead of sdists is to use pep517.
# workaround from https://github.com/tox-dev/tox/issues/185
changedir = bindings/python
skip_install = true
deps =
pytest
mypy
# Build the wheel to match our environment's python, and install it to the
# environment.
# Invocation notes:
# - python -X dev: this enables a debug allocator which causes bad allocs to
# abort immediately, rather than corrupt memory. This has caught several bugs
# in the past
# - We'd like to use python -W error::DeprecationWarning:tests.*, but this
# this example from the docs doesn't work, as the module regex is always
# escaped. We can't use a broader -W error::DeprecationWarning because
# numerous DeprecationWarnings are fired from builtin code, especially
# site.py. We can't use warnings.filterwarnings() in test code because
# TestCase.assertWarns() seems to reset these.
# - It's possible to enable parallelism via pytest-xdist. However in practice:
# - It mixes up debug output
# - It makes rare crashes harder to trace
# - It hides warnings
# - As of writing, it only saves about 7 seconds on my machine
# - Note that multithreading with pytest-parallel doesn't work correctly
# because assertWarns isn't threadsafe
# Invocation notes for mypy:
# - We run this in tox to test the *packaging* of the type stubs. mypy should
# be able to find them in the installed environment.
# - To ensure mypy *only* looks for the packaged type stubs and not the files
# in the python directory, only run mypy on the tests dir.
commands =
{envpython} setup.py bdist_wheel
{envpython} -m pip install --upgrade --force-reinstall --ignore-installed --find-links=dist python-libtorrent
{envpython} -m pip install -r test-requirements.txt
{envpython} -X dev -m pytest --log-level=DEBUG --log-cli-level=DEBUG
{envpython} -m mypy --config-file mypy-tox.ini tests