HPI/tox.ini
Dima Gerasimov ddea816a49 my.stackexchange: use proper pip package, add stat
+ 'anonymous' mode for stat() function
2020-12-11 07:02:16 +01:00

90 lines
3.4 KiB
INI

[tox]
minversion = 3.5
envlist = py3,mypy,mypy-modules
# TODO ugh. unclear how to reuse setup.cfg deps in tox
[testenv]
passenv = CI CI_*
# deliberately set to nonexistent path to check the fallback logic
setenv = MY_CONFIG = nonexistent
commands =
pip install -e .[testing]
# python -m pytest {posargs}
# my.location.google deps
pip install geopy ijson
# my.time.tz.via_location dep
pip install timezonefinder
# my.calendar.holidays dep
pip install workalendar
# my.body.weight dep
pip install orgparse
python3 -m pytest \
tests/core.py \
tests/misc.py \
tests/get_files.py \
tests/config.py::test_environment_variable \
tests/demo.py \
tests/bluemaestro.py \
tests/location.py \
tests/tz.py \
tests/calendar.py \
tests/config.py
hpi modules
[testenv:demo]
commands = ./demo.py
# specific modules that are known to be mypy compliant (to avoid false negatives)
[testenv:mypy-modules]
whitelist_externals = bash
commands =
pip install -e .[testing] .[optional]
pip install orgparse
pip install git+https://github.com/karlicoss/endoexport
pip install git+https://github.com/karlicoss/ghexport
pip install git+https://github.com/karlicoss/hypexport
pip install git+https://github.com/karlicoss/instapexport
pip install git+https://github.com/karlicoss/pockexport
pip install git+https://github.com/karlicoss/rexport
pip install git+https://github.com/karlicoss/stexport
# ugh fuck. soo... need to reset HOME, otherwise user's site-packages are somehow leaking into mypy's path...
# see https://github.com/python/mypy/blob/f6fb60ef69738cbfe2dfe56c747eca8f03735d8e/mypy/modulefinder.py#L487
# this is particularly annoying when user's config is leaking and mypy isn't running against the repository config
# maybe this issue... https://github.com/tox-dev/tox/issues/838
# and also since it's Tox, we can't just set an env variable for a single command, have to spawn a subshell. jeez.
# TODO fuck. -p my.github isn't checking the subpackages?? wtf...
bash -c 'HOME= \
python3 -m mypy \
-p my.endomondo \
-p my.github.ghexport \
-p my.hypothesis \
-p my.instapaper \
-p my.pocket \
-p my.reddit \
-p my.stackexchange.stexport \
-p my.body.exercise.cardio \
-p my.body.exercise.cross_trainer \
-p my.bluemaestro \
-p my.location.google \
-p my.time.tz.via_location \
-p my.calendar.holidays \
--txt-report .mypy-coverage \
--html-report .mypy-coverage \
{posargs}'
# txt report is a bit more convenient to view on CI
# ideally, keep core modules only here
[testenv:mypy]
skip_install = true
commands =
pip install -e .[testing] .[optional] orgparse
./lint