-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fade to black #314
Fade to black #314
Conversation
Move environment config nearer to where it is used.
@@ -102,8 +104,8 @@ matrix: | |||
|
|||
|
|||
install: | |||
- ./.travis/install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script doesn't do anything useful any more; tossing it.
|
||
|
||
script: | ||
- ./.travis/run tox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script doesn't do anything useful any more; tossing it.
src/klein/test/test_resource.py
Outdated
( | ||
"Request.finish called on a request after its connection " | ||
"was lost; use Request.notifyFinish to keep track of this." | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so that when black reformats it, we stay within max line length.
store.newSession(True, SessionMechanism.Header) | ||
) | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so that when black reformats it, we the # type: ignore
comment for ISession
stays with it.
u"Can't initialize a session on a " | ||
u"{method} request.".format( | ||
method=request.method.decode("ascii") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so that when black reformats it, we stay within max line length.
/.coverage | ||
/.coverage.* | ||
/.eggs | ||
/.hypothesis/ | ||
/.mypy_cache | ||
/.tox/ | ||
/_trial_temp/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These scribble into ./.tox/
docs, docs-linkcheck | ||
packaging | ||
|
||
skip_missing_interpreters = {tty:True:False} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True only in interactive shells
skip_missing_interpreters = {tty:True:False} | ||
|
||
|
||
[default] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This environment holds values that can be reused later, allowing use to set them in one place.
|
||
skip_missing_interpreters = {env:TOX_SKIP_MISSING_INTERPRETERS:True} | ||
PYTHONPYCACHEPREFIX={envtmpdir}/pycache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write __pycache__
in ./tox/
to reduce the number of build artifacts left in the source tree.
passenv = | ||
# See https://github.com/codecov/codecov-python/blob/5b9d539a6a09bc84501b381b563956295478651a/README.md#using-tox | ||
codecov: TOXENV | ||
codecov: CI | ||
codecov: TRAVIS TRAVIS_* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved down to codecov
environment.
PIP_DISABLE_PIP_VERSION_CHECK=1 | ||
VIRTUALENV_NO_DOWNLOAD=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren't necessary any more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to tox-dev/tox#448 shipped in Tox v3.10.0. Perhaps we should set [tox] minversion = 3.10.0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to that, but I wouldn't do that based on just these, since I think Tox still works (in most situations) if pip
and virtualenv
do these goofy things.
|
||
# Run trial with coverage | ||
coverage: coverage run -p "{envbindir}/trial" --random=0 --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:klein} | ||
coverage: coverage run --source {env:PY_MODULE} "{envdir}/bin/trial" --random=0 --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds --source
and uses {env:PY_MODULE}
coverage: coverage run --source {env:PY_MODULE} "{envdir}/bin/trial" --random=0 --logfile="{envlogdir}/trial.log" --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}} | ||
|
||
# Run coverage reports, ignore exit status | ||
coverage: - coverage report --skip-covered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes uncovered code for this environment.
black {env:BLACK_LINT_ARGS:} src | ||
|
||
|
||
[testenv:black-reformat] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one actually reformats the code in place.
tox.ini
Outdated
######## WARNINGS BELOW SHOULD BE FIXED ######## | ||
|
||
# Missing docstring in public module | ||
D100, | ||
|
||
# Missing docstring in public class | ||
D101, | ||
|
||
# Missing docstring in public method | ||
D102, | ||
|
||
# Missing docstring in public function | ||
D103, | ||
|
||
# Missing docstring in public package | ||
D104, | ||
|
||
# Missing docstring in magic method | ||
D105, | ||
|
||
# too many blank lines | ||
E302, | ||
# Missing docstring in __init__ | ||
D107, | ||
|
||
# too many blank lines | ||
E303, | ||
# Use """triple double quotes""" | ||
D300, | ||
|
||
# expected 2 blank lines after class or function definition | ||
E305, | ||
# First word of the first line should be properly capitalized | ||
D403, | ||
|
||
# Additional newline in a group of imports | ||
I202, | ||
|
||
######## WARNINGS ABOVE SHOULD BE FIXED ######## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are newly-enabled warnings that should be addressed in other PRs.
@@ -174,17 +258,13 @@ max-complexity = 60 | |||
|
|||
description = run Mypy (static type checker) | |||
|
|||
basepython = python3.8 | |||
|
|||
skip_install = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't skip installing the project (and dependencies) because that's how you get type stubs from dependencies.
|
||
description = generate coverage report | ||
|
||
depends = {test,coverage}-py{27,35,36,37,38,py2,py3}-tw{171,184,current,trunk} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait for test environments to complete before running this one (only matters if you run them in parallel).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking forward to stealing much of this for Twisted and treq!
include LICENSE | ||
include README.rst | ||
include .coveragerc | ||
include .travis/twistedchecker-diff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to include this in distributions? It's not useful out of VCS, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think .coveragerc
should be included, so you can run Tox from a source distribution and get the same results we get in development.
twistedchecker-diff
should go away entirely… I'll submit a PR for that.
PIP_DISABLE_PIP_VERSION_CHECK=1 | ||
VIRTUALENV_NO_DOWNLOAD=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to tox-dev/tox#448 shipped in Tox v3.10.0. Perhaps we should set [tox] minversion = 3.10.0
?
The travis envs fail because codecov got moved around, but otherwise, looks good. If you can fix that, run black, and verify that everything that's green in travis should be, go for it. |
as an aside, we use this flake8 configuration on synapse:
I'd go with just these, tbh, and see how they go? |
This reverts commit 22c1ffd.
… in python2.7, and that avoids this.
Codecov Report
@@ Coverage Diff @@
## master #314 +/- ##
=========================================
Coverage ? 98.15%
=========================================
Files ? 48
Lines ? 3903
Branches ? 259
=========================================
Hits ? 3831
Misses ? 55
Partials ? 17
Continue to review full report at Codecov.
|
Hey @ambv FYI |
I didn't mention this, but all of the muted warnings in the config right now would cause an error if removed. |
This PR will adopt
black
code formatting for Klein.Note that I have not checked in any of the reformatted files yet, because if I do, merging this after some other PR gets merged will be nutso. So this is currently just checking to see if people agree with this configuration change.
To see what the code changes look like, check out this branch and run:
tox -e black-reformat
At that point the
flake8
andblack
Tox environments should pass.