-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
112 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
lint.ignore = [ | ||
### too opinionated style checks | ||
"E501", # too long lines | ||
"E702", # Multiple statements on one line (semicolon) | ||
"E731", # assigning lambda instead of using def | ||
"E741", # Ambiguous variable name: `l` | ||
"E742", # Ambiguous class name: `O | ||
"E401", # Multiple imports on one line | ||
"F403", # import *` used; unable to detect undefined names | ||
### | ||
|
||
### | ||
"E722", # Do not use bare `except` ## Sometimes it's useful for defensive imports and that sort of thing.. | ||
"F811", # Redefinition of unused # this gets in the way of pytest fixtures (e.g. in cachew) | ||
|
||
## might be nice .. but later and I don't wanna make it strict | ||
"E402", # Module level import not at top of file | ||
|
||
### maybe consider these soon | ||
# sometimes it's useful to give a variable a name even if we don't use it as a documentation | ||
# on the other hand, often is a sign of error | ||
"F841", # Local variable `count` is assigned to but never used | ||
"F401", # imported but unused | ||
### | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,49 @@ | ||
[tox] | ||
minversion = 3.5 | ||
minversion = 3.21 | ||
# relies on the correct version of Python installed | ||
envlist = tests,mypy | ||
envlist = ruff,tests,mypy | ||
# 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] | ||
passenv = | ||
# TODO how to get package name from setuptools? | ||
package_name = "server" | ||
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 .[linting] | ||
{envpython} -m ruff check server/ | ||
|
||
|
||
[testenv:tests] | ||
commands = | ||
pip install -e .[testing] | ||
{envpython} -m pip install --use-pep517 -e .[testing] | ||
# posargs allow test filtering, e.g. tox ... -- -k test_name | ||
python -m pytest server --ignore server/test_with_browser.py {posargs} | ||
{envpython} -m pytest \ | ||
'server' --ignore 'server/test_with_browser.py' \ | ||
{posargs} | ||
|
||
|
||
[testenv:mypy] | ||
commands = | ||
pip install -e .[linting] | ||
python -m mypy --install-types --non-interactive \ | ||
server \ | ||
# txt report is a bit more convenient to view on CI | ||
--txt-report .coverage.mypy \ | ||
--html-report .coverage.mypy \ | ||
{posargs} | ||
{envpython} -m pip install --use-pep517 -e .[linting] | ||
{envpython} -m mypy --install-types --non-interactive \ | ||
'server' \ | ||
# txt report is a bit more convenient to view on CI | ||
--txt-report .coverage.mypy \ | ||
--html-report .coverage.mypy \ | ||
{posargs} |