CI: clean up tox config a bit, get rid of custom lint script
This commit is contained in:
parent
f102101b39
commit
56d5587c20
6 changed files with 50 additions and 132 deletions
56
tox.ini
56
tox.ini
|
@ -1,10 +1,11 @@
|
|||
[tox]
|
||||
minversion = 3.5
|
||||
envlist = py3,mypy,mypy-modules
|
||||
|
||||
# TODO ugh. unclear how to reuse setup.cfg deps in tox
|
||||
[testenv]
|
||||
passenv = CI CI_*
|
||||
|
||||
# TODO ugh. unclear how to reuse setup.cfg deps in tox
|
||||
[testenv:tests]
|
||||
# deliberately set to nonexistent path to check the fallback logic
|
||||
setenv = MY_CONFIG = nonexistent
|
||||
commands =
|
||||
|
@ -13,6 +14,7 @@ commands =
|
|||
pip install -e .[testing]
|
||||
# python -m pytest {posargs}
|
||||
|
||||
# TODO install via helper script..
|
||||
# my.location.google deps
|
||||
pip install geopy ijson
|
||||
|
||||
|
@ -34,12 +36,28 @@ commands =
|
|||
|
||||
|
||||
[testenv:demo]
|
||||
commands = ./demo.py
|
||||
commands =
|
||||
pip install git+https://github.com/karlicoss/hypexport
|
||||
./demo.py
|
||||
|
||||
|
||||
[testenv:mypy-core]
|
||||
whitelist_externals = cat
|
||||
commands =
|
||||
pip install -e .[testing,optional]
|
||||
pip install orgparse # used it core.orgparse?
|
||||
# todo add tests?
|
||||
python3 -m mypy -p my.core \
|
||||
--txt-report .coverage.mypy-core \
|
||||
--html-report .coverage.mypy-core \
|
||||
{posargs}
|
||||
cat .coverage.mypy-core/index.txt
|
||||
|
||||
|
||||
# specific modules that are known to be mypy compliant (to avoid false negatives)
|
||||
[testenv:mypy-modules]
|
||||
whitelist_externals = bash
|
||||
# todo maybe split into separate jobs? need to add comment how to run
|
||||
# and install dependencies via AST thing?
|
||||
[testenv:mypy-misc]
|
||||
commands =
|
||||
pip install -e .[testing,optional]
|
||||
pip install orgparse
|
||||
|
@ -51,13 +69,7 @@ commands =
|
|||
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 \
|
||||
|
@ -72,15 +84,19 @@ commands =
|
|||
-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 .coverage.mypy-misc \
|
||||
--html-report .coverage.mypy-misc \
|
||||
{posargs}
|
||||
# txt report is a bit more convenient to view on CI
|
||||
|
||||
# note: this comment doesn't seem relevant anymore, but keeping it in case the issue happens again
|
||||
# > ugh ... 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
|
||||
|
||||
# ideally, keep core modules only here
|
||||
[testenv:mypy]
|
||||
skip_install = true
|
||||
commands =
|
||||
pip install -e .[testing,optional] orgparse
|
||||
./lint
|
||||
|
||||
# useful flags:
|
||||
# * sitepackages = true to inherit user/globally installed packages (default false)
|
||||
# * skip_install = true -- not sure when useful? (default false)
|
||||
# * -e to run specific subenvironment
|
||||
# * pass arguments with -- , e.g. `tox -e tests -- -k some_test_name` to only run one test with pytest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue