Mercurial > p > roundup > code
annotate pyproject.toml @ 8531:4fe0d14cf915
chore(build): bump actions/upload-artifact from 6.0.0 to 7.0.0. #84
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 10 Mar 2026 22:52:54 -0400 |
| parents | 8a875e0bf749 |
| children |
| rev | line source |
|---|---|
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
1 [tool.pytest.ini_options] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
2 # Note this only works under python3. Pytest 6.0+ supports |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
3 # pyproject.toml and is not available for python 2. These settings can |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
4 # be adapted for pytest.ini if you are running under python2. |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
5 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
6 # For use with packages: |
|
8252
8a875e0bf749
test: added pytest-testmon
John Rouillard <rouilj@ieee.org>
parents:
8235
diff
changeset
|
7 # python -m pip install pytest-cov pytest-env pytest-randomly pytest-testmon |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
8 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
9 minversion = "6.0" |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
10 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
11 # Disable randomly by default. There are still a few tests that are |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
12 # order dependent. Enable on cli for python3 only using: |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
13 # "-p randomly" |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
14 addopts = "-p no:randomly --durations=10 --strict-markers -r a -v" |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
15 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
16 # Set the redis password to nothing. Can be overridden on cli using: |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
17 # "-e pytest_redis_pw=mySecretPassword" |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
18 env = [ |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
19 "D:pytest_redis_pw=" |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
20 ] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
21 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
22 # Don't search random directories to find tests. |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
23 testpaths = [ |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
24 "test", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
25 ] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
26 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
27 [tool.ruff] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
28 line-length = 128 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
29 output-format = "full" |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
30 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
31 exclude = [ |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
32 # ignore code imported/sourced from other places |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
33 "roundup/cgi/PageTemplates/*.py", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
34 "roundup/cgi/TAL/*.py", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
35 "roundup/cgi/ZTUtils/*.py", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
36 "roundup/anypy/vendored/*.py", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
37 "dicttoxml.py" |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
38 ] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
39 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
40 [tool.ruff.lint] |
| 7831 | 41 preview = true |
| 42 explicit-preview-rules = true | |
| 43 | |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
44 select = [ |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
45 "A", # flake-8-builtins shadowing a builtin |
| 7831 | 46 "ARG", # flake8-unused-arguments |
| 47 "B", # flake8-bugbear | |
| 48 "C4", # flake8-comprehensions | |
| 49 "C901", # McCabe complexity | |
| 50 "COM", # flake8-commas | |
| 51 "E", # errors | |
| 52 # enable preview rules: | |
| 53 # Error rules indentation | |
| 54 "E111", "E112", "E113", | |
| 55 # Error whitespace in brackets/around punctuation | |
| 56 # around params, tabs/space around operators | |
| 57 "E201", "E202", "E203", "E211", "E222", "E223", "E224", | |
| 58 "E225", "E226", "E227", "E228", "E231", "E241", "E242", | |
| 59 "E251", "E252", "E271", "E272", "E275", | |
| 60 # Error blank lines between methods, classes etc. | |
| 61 "E301", "E302", "E303", "E304", "E305", "E306", | |
| 62 | |
| 63 "F", # pyflakes | |
| 64 "G", # logging format _(.... % ...) bad use _(...) % ... | |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
65 "I", # imports |
| 7831 | 66 "INT", # check gettext |
| 67 "Q", # quoting consistancy | |
| 68 "PERF", # performance lint | |
| 69 "PIE794", # duplicate class field definition | |
| 70 "PL", # pylint | |
| 71 "PLW", # warnings | |
| 72 "RET", # check for inconistent returns | |
| 73 "RUF", # ruff | |
| 74 "S", # bandit - security | |
| 75 "SIM", # simplify code | |
| 76 "T10", # flake8-debugger | |
| 77 "W", # pycode whitespace warnings | |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
78 ] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
79 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
80 ignore = [ |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
81 # raise from except hander with none or chaining; only python3 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
82 "B904", |
|
8235
c41e669a655c
chore(ruff): update scanning rules.
John Rouillard <rouilj@ieee.org>
parents:
8176
diff
changeset
|
83 # trailing commas are getting a bit excessive |
|
c41e669a655c
chore(ruff): update scanning rules.
John Rouillard <rouilj@ieee.org>
parents:
8176
diff
changeset
|
84 "COM812", |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
85 # ### before comments is fine |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
86 "E266", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
87 # ignore double vs. single quotes |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
88 "Q000", "Q001", "Q002", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
89 # do not replace x in (a,b) with x in {a,b} (set). python 3.2 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
90 # got a speedup in this; only python 3 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
91 "PLR6201", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
92 # 505: allow use of else/elif even if it could be removed. |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
93 # if X: return; elif Z: return; else v -> |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
94 # if X: return; if Z: return; v |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
95 # 506: same but with a raise rather than return |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
96 #"RET505", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
97 #"RET506", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
98 # use *list to expand; only python 3 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
99 "RUF005", |
|
8235
c41e669a655c
chore(ruff): update scanning rules.
John Rouillard <rouilj@ieee.org>
parents:
8176
diff
changeset
|
100 # not using typing, so not marking mutable class values |
|
c41e669a655c
chore(ruff): update scanning rules.
John Rouillard <rouilj@ieee.org>
parents:
8176
diff
changeset
|
101 "RUF012", |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
102 # do not use contextlib.suppress rather than except: pass to suppress |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
103 # exception. contextlib doesn't work in python2 and is slower |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
104 "SIM105", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
105 ] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
106 |
|
8176
736f769b48c8
A few cleanups to toml format. alphabetize, whitespace...
John Rouillard <rouilj@ieee.org>
parents:
7831
diff
changeset
|
107 [tool.ruff.lint.mccabe] |
|
736f769b48c8
A few cleanups to toml format. alphabetize, whitespace...
John Rouillard <rouilj@ieee.org>
parents:
7831
diff
changeset
|
108 max-complexity = 50 |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
109 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
110 [tool.ruff.lint.per-file-ignores] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
111 "roundup/anypy/*.py" = ["RET505", "RET506"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
112 "roundup/dehtml.py" = ["E501"] |
|
8235
c41e669a655c
chore(ruff): update scanning rules.
John Rouillard <rouilj@ieee.org>
parents:
8176
diff
changeset
|
113 # ruff is reporting unused parameters. Standard calling sequence |
|
c41e669a655c
chore(ruff): update scanning rules.
John Rouillard <rouilj@ieee.org>
parents:
8176
diff
changeset
|
114 # for all methods means some won't be used. Suppress alert ARG002. |
|
c41e669a655c
chore(ruff): update scanning rules.
John Rouillard <rouilj@ieee.org>
parents:
8176
diff
changeset
|
115 "roundup/rest.py" = ["ARG002", "E501"] |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
116 "roundup/support.py" = ["E401"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
117 "roundup/security.py" = ["E701"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
118 "roundup/date.py" = ["E231", "E701"] |
|
8176
736f769b48c8
A few cleanups to toml format. alphabetize, whitespace...
John Rouillard <rouilj@ieee.org>
parents:
7831
diff
changeset
|
119 "roundup/backends/back_sqlite.py" = ["E203"] |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
120 |
|
8176
736f769b48c8
A few cleanups to toml format. alphabetize, whitespace...
John Rouillard <rouilj@ieee.org>
parents:
7831
diff
changeset
|
121 [tool.ruff.lint.pylint] |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
122 max-args = 6 |
|
8176
736f769b48c8
A few cleanups to toml format. alphabetize, whitespace...
John Rouillard <rouilj@ieee.org>
parents:
7831
diff
changeset
|
123 max-branches = 20 |
|
7822
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
124 max-statements = 100 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
125 |
