-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathtox.ini
132 lines (117 loc) · 4.28 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
[tox]
minversion = 3.21
# relies on the correct version of Python installed
envlist = ruff,tests-core,tests-all,mypy-core,mypy-misc
# NOTE: we don't run end2end by default since it requires elaborate setup
# 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
[testenv]
# TODO how to get package name from setuptools?
package_name = "promnesia"
passenv =
# useful for tests to know they are running under ci
CI
CI_*
# respect user's cache dirs to prevent tox from crapping into project dir
PYTHONPYCACHEPREFIX
MYPY_CACHE_DIR
RUFF_CACHE_DIR
#
MY_CONFIG
# by default we don't run browser tests to avoid confusing people when they run locally
# but we want them on CI, so we allow to pass through the variable when we do want to run them
WITH_BROWSER_TESTS
# todo ugh this is all so confusing... need to simplify
usedevelop = true # for some reason tox seems to ignore "-e ." in deps section??
uv_seed = true # seems necessary so uv creates separate venvs per tox env?
setenv =
HPI_MODULE_INSTALL_USE_UV=true
[testenv:ruff]
dependency_groups = testing
commands =
{envpython} -m ruff check src/
# just the very core tests with minimal dependencies
[testenv:tests-core]
dependency_groups = testing
deps =
-e .[markdown]
# NOTE: markdown is only used for test_cli... might be nice to decouple
commands =
# posargs allow test filtering, e.g. tox ... -- -k test_name
{envpython} -m pytest \
--pyargs {[testenv]package_name} \
# note: sources are tested in tests-all
--ignore src/promnesia/sources \
--ignore src/promnesia/tests/sources \
{posargs}
[testenv:tests-all]
dependency_groups = testing
deps =
-e .[all,HPI,org]
beautifulsoup4<4.13.0 # FIXME temporary hack until https://github.com/purarue/google_takeout_parser/pull/81 is merged
uv # for hpi module install
commands =
# used in some tests
{envpython} -m my.core module install \
my.google.takeout.parser \
my.hypothesis
{envpython} -m pytest \
--pyargs {[testenv]package_name} \
{posargs}
[testenv:end2end]
setenv =
WITH_BROWSER_TESTS=true
PYTEST_TIMEOUT=120
dependency_groups =
testing
testing-end2end
deps =
-e .[HPI]
uv # for hpi module install
commands =
{envpython} -m my.core module install my.hypothesis
{envpython} -m pytest \
# TODO noconftest is hack due to end2end tests being in a separate dir
# ideally need to just move it inside the package as well
--noconftest \
tests/end2end_test.py \
{posargs}
[testenv:mypy-core]
dependency_groups = testing
commands =
{envpython} -m mypy --no-install-types \
# note: sources are tested separately, below
-p {[testenv]package_name} --exclude 'sources/*' \
# txt report is a bit more convenient to view on CI
--txt-report .coverage.mypy-core \
--html-report .coverage.mypy-core \
{posargs}
[testenv:mypy-misc]
dependency_groups = testing
deps =
-e .[HPI,org,markdown] # todo install from HPI[all] or something?
beautifulsoup4<4.13.0 # FIXME temporary hack until https://github.com/purarue/google_takeout_parser/pull/81 is merged
uv # for hpi module install
commands =
{envpython} -m my.core module install \
my.github.ghexport \
my.hypothesis \
my.instapaper \
my.pocket \
my.reddit \
my.fbmessenger \
my.google.takeout.parser \
my.browser.export
{envpython} -m mypy --no-install-types \
-p {[testenv]package_name}.sources \
# txt report is a bit more convenient to view on CI
--txt-report .coverage.mypy-misc \
--html-report .coverage.mypy-misc \
{posargs}
# ugh. a bit crap to run it separately
# but first will need to move tests inside the package if we want otherwise?
# and I recall it was problematic at times..
{envpython} -m mypy --no-install-types \
tests --exclude 'testdata/*' \
{posargs}