Mercurial > p > roundup > code
annotate pyproject.toml @ 7965:6763813d9d34
issue2551350 - Python changes for 3.12 with roundup 2.3.0 cgitb.py
Fix change in pydoc.html.header() signature. It dropped foreground and
background color arguments in 3.11 and newer.
Also enable test code for the html function.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 14 May 2024 21:27:28 -0400 |
| parents | 9c58f5940c20 |
| children | 736f769b48c8 |
| 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: |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
7 # python -m pip install pytest-cov pytest-env pytest-randomly |
|
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", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
83 # ### before comments is fine |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
84 "E266", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
85 # ignore double vs. single quotes |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
86 "Q000", "Q001", "Q002", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
87 # 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
|
88 # 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
|
89 "PLR6201", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
90 # 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
|
91 # 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
|
92 # 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
|
93 # 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
|
94 #"RET505", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
95 #"RET506", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
96 # 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
|
97 "RUF005", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
98 # 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
|
99 # 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
|
100 "SIM105", |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
101 ] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
102 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
103 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
104 [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
|
105 "roundup/anypy/*.py" = ["RET505", "RET506"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
106 "roundup/dehtml.py" = ["E501"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
107 "roundup/rest.py" = ["E501"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
108 "roundup/support.py" = ["E401"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
109 "roundup/security.py" = ["E701"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
110 "roundup/date.py" = ["E231", "E701"] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
111 "roundup/backends/back_sqlite.py" = [ "E203" ] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
112 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
113 [too.ruff.lint.pylint] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
114 max-args = 6 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
115 max-branches=20 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
116 max-statements = 100 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
117 |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
118 [tool.ruff.lint.mccabe] |
|
1b7162938988
test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff
changeset
|
119 max-complexity = 50 |
