ci: sync configs to pymplate
- add python3.12 - add ruff
This commit is contained in:
parent
fabcbab751
commit
0512488241
9 changed files with 117 additions and 74 deletions
114
tox.ini
114
tox.ini
|
@ -1,31 +1,41 @@
|
|||
[tox]
|
||||
minversion = 3.5
|
||||
envlist = tests-core,tests-all,demo,mypy-core,mypy-misc
|
||||
minversion = 3.21
|
||||
# relies on the correct version of Python installed
|
||||
envlist = ruff,tests-core,tests-all,demo,mypy-core,mypy-misc
|
||||
# https://github.com/tox-dev/tox/issues/20#issuecomment-247788333
|
||||
# hack to prevent .tox from crapping to the project directory
|
||||
toxworkdir={env:TOXWORKDIR_BASE:}{toxinidir}/.tox
|
||||
toxworkdir = {env:TOXWORKDIR_BASE:}{toxinidir}/.tox
|
||||
|
||||
[testenv]
|
||||
# TODO how to get package name from setuptools?
|
||||
package_name = "my"
|
||||
passenv =
|
||||
# useful for tests to know they are running under ci
|
||||
CI
|
||||
CI_*
|
||||
CI
|
||||
CI_*
|
||||
# respect user's cache dirs to prevent tox from crapping into project dir
|
||||
MYPY_CACHE_DIR
|
||||
PYTHONPYCACHEPREFIX
|
||||
PYTHONPYCACHEPREFIX
|
||||
MYPY_CACHE_DIR
|
||||
RUFF_CACHE_DIR
|
||||
|
||||
|
||||
# note: --use-pep517 below is necessary for tox --parallel flag to work properly
|
||||
# otherwise it seems that it tries to modify .eggs dir in parallel and it fails
|
||||
|
||||
|
||||
[testenv:ruff]
|
||||
commands =
|
||||
{envpython} -m pip install --use-pep517 -e .[testing]
|
||||
{envpython} -m ruff my/
|
||||
|
||||
|
||||
# just the very core tests with minimal dependencies
|
||||
[testenv:tests-core]
|
||||
commands =
|
||||
pip install --use-pep517 -e .[testing]
|
||||
{envpython} -m pip install --use-pep517 -e .[testing]
|
||||
|
||||
# seems that denylist tests rely on it? ideally we should get rid of this in tests-core
|
||||
pip install orjson
|
||||
{envpython} -m pip install orjson
|
||||
|
||||
{envpython} -m pytest \
|
||||
# importlib is the new suggested import-mode
|
||||
|
@ -51,72 +61,72 @@ commands =
|
|||
# TODO not sure if need it?
|
||||
setenv = MY_CONFIG = nonexistent
|
||||
commands =
|
||||
pip install --use-pep517 -e .[testing]
|
||||
{envpython} -m pip install --use-pep517 -e .[testing]
|
||||
|
||||
# installed to test my.core.serialize while using simplejson and not orjson
|
||||
pip install simplejson
|
||||
{envpython} -m pip install simplejson
|
||||
{envpython} -m pytest \
|
||||
tests/serialize_simplejson.py \
|
||||
{posargs}
|
||||
tests/serialize_simplejson.py \
|
||||
{posargs}
|
||||
|
||||
pip install cachew
|
||||
pip install orjson
|
||||
{envpython} -m pip install cachew
|
||||
{envpython} -m pip install orjson
|
||||
|
||||
hpi module install my.location.google
|
||||
pip install ijson # optional dependency
|
||||
{envpython} -m my.core module install my.location.google
|
||||
{envpython} -m pip install ijson # optional dependency
|
||||
|
||||
# tz/location
|
||||
hpi module install my.time.tz.via_location
|
||||
hpi module install my.ip.all
|
||||
hpi module install my.location.gpslogger
|
||||
hpi module install my.location.fallback.via_ip
|
||||
hpi module install my.google.takeout.parser
|
||||
{envpython} -m my.core module install my.time.tz.via_location
|
||||
{envpython} -m my.core module install my.ip.all
|
||||
{envpython} -m my.core module install my.location.gpslogger
|
||||
{envpython} -m my.core module install my.location.fallback.via_ip
|
||||
{envpython} -m my.core module install my.google.takeout.parser
|
||||
|
||||
hpi module install my.calendar.holidays
|
||||
{envpython} -m my.core module install my.calendar.holidays
|
||||
|
||||
# my.body.weight dep
|
||||
hpi module install my.orgmode
|
||||
{envpython} -m my.core module install my.orgmode
|
||||
|
||||
hpi module install my.coding.commits
|
||||
{envpython} -m my.core module install my.coding.commits
|
||||
|
||||
hpi module install my.pdfs
|
||||
{envpython} -m my.core module install my.pdfs
|
||||
|
||||
hpi module install my.reddit.rexport
|
||||
{envpython} -m my.core module install my.reddit.rexport
|
||||
|
||||
{envpython} -m pytest \
|
||||
# importlib is the new suggested import-mode
|
||||
# without it test package names end up as core.tests.* instead of my.core.tests.*
|
||||
--import-mode=importlib \
|
||||
--pyargs my.tests \
|
||||
--pyargs {[testenv]package_name}.tests \
|
||||
{posargs}
|
||||
|
||||
{envpython} -m pytest tests \
|
||||
# ignore some tests which might take a while to run on ci..
|
||||
--ignore tests/takeout.py \
|
||||
--ignore tests/extra/polar.py \
|
||||
# dont run simplejson compatibility test since orjson is now installed
|
||||
--ignore tests/serialize_simplejson.py \
|
||||
{posargs}
|
||||
# ignore some tests which might take a while to run on ci..
|
||||
--ignore tests/takeout.py \
|
||||
--ignore tests/extra/polar.py \
|
||||
# dont run simplejson compatibility test since orjson is now installed
|
||||
--ignore tests/serialize_simplejson.py \
|
||||
{posargs}
|
||||
|
||||
|
||||
[testenv:demo]
|
||||
commands =
|
||||
pip install git+https://github.com/karlicoss/hypexport
|
||||
{envpython} -m pip install git+https://github.com/karlicoss/hypexport
|
||||
{envpython} ./demo.py
|
||||
|
||||
|
||||
[testenv:mypy-core]
|
||||
allowlist_externals = cat
|
||||
commands =
|
||||
pip install --use-pep517 -e .[testing,optional]
|
||||
pip install orgparse # used it core.orgmode?
|
||||
pip install gpxpy # for hpi query --output gpx
|
||||
{envpython} -m pip install --use-pep517 -e .[testing,optional]
|
||||
{envpython} -m pip install orgparse # used it core.orgmode?
|
||||
{envpython} -m pip install gpxpy # for hpi query --output gpx
|
||||
|
||||
{envpython} -m mypy --install-types --non-interactive \
|
||||
-p my.core \
|
||||
--txt-report .coverage.mypy-core \
|
||||
--html-report .coverage.mypy-core \
|
||||
{posargs}
|
||||
-p {[testenv]package_name}.core \
|
||||
--txt-report .coverage.mypy-core \
|
||||
--html-report .coverage.mypy-core \
|
||||
{posargs}
|
||||
cat .coverage.mypy-core/index.txt
|
||||
|
||||
|
||||
|
@ -125,9 +135,9 @@ commands =
|
|||
[testenv:mypy-misc]
|
||||
allowlist_externals = cat
|
||||
commands =
|
||||
pip install --use-pep517 -e .[testing,optional]
|
||||
{envpython} -m pip install --use-pep517 -e .[testing,optional]
|
||||
|
||||
hpi module install --parallel \
|
||||
{envpython} -m my.core module install --parallel \
|
||||
my.arbtt \
|
||||
my.browser.export \
|
||||
my.coding.commits \
|
||||
|
@ -157,18 +167,18 @@ commands =
|
|||
|
||||
|
||||
{envpython} -m mypy --install-types --non-interactive \
|
||||
-p my \
|
||||
--exclude 'my/coding/codeforces.py' \
|
||||
--exclude 'my/coding/topcoder.py' \
|
||||
--exclude 'my/jawbone/.*' \
|
||||
--txt-report .coverage.mypy-misc \
|
||||
--html-report .coverage.mypy-misc \
|
||||
{posargs}
|
||||
-p {[testenv]package_name} \
|
||||
--exclude 'my/coding/codeforces.py' \
|
||||
--exclude 'my/coding/topcoder.py' \
|
||||
--exclude 'my/jawbone/.*' \
|
||||
--txt-report .coverage.mypy-misc \
|
||||
--html-report .coverage.mypy-misc \
|
||||
{posargs}
|
||||
# txt report is a bit more convenient to view on CI
|
||||
cat .coverage.mypy-misc/index.txt
|
||||
|
||||
{envpython} -m mypy --install-types --non-interactive \
|
||||
tests
|
||||
tests
|
||||
|
||||
# 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...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue