Skip to content
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

Merge py3_test_resource.py into test_resource.py #355

Merged
merged 9 commits into from Jun 9, 2020
Merged

Conversation

wsanchez
Copy link
Member

@wsanchez wsanchez commented Jun 8, 2020

Merge py3_test_resource.py into test_resource.py.

The separate file was there to avoid confusing Python 2.

Opportunistically clean up some code that is now extraneous due to dropping Python 2 or old versions of Twisted.

@wsanchez wsanchez requested a review from a team as a code owner June 8, 2020 22:27
@wsanchez wsanchez self-assigned this Jun 8, 2020
Comment on lines -11 to -18

try:
from inspect import iscoroutine
except ImportError:

def iscoroutine(*args, **kwargs): # type: ignore
return False

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can assume iscoroutine is available; added in Python 3.5.

Comment on lines -27 to -34
try:
from twisted.internet.defer import ensureDeferred
except ImportError:

def ensureDeferred(*args, **kwagrs):
raise NotImplementedError("Coroutines support requires Twisted>=16.6")


Copy link
Member Author

@wsanchez wsanchez Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twisted <16.6 hasn't been on our test matrix for some time

Comment on lines -5 to -8
try:
from constantly import NamedConstant, Names
except ImportError: # pragma: no cover
from twisted.python.constants import NamedConstant, Names
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pragma: no cover is here because no version of Twisted in our test matrix causes this code to be used. Let's just assume Twisted is using constantly.

@codecov
Copy link

codecov bot commented Jun 9, 2020

Codecov Report

Merging #355 into master will increase coverage by 0.36%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #355      +/-   ##
==========================================
+ Coverage   97.87%   98.24%   +0.36%     
==========================================
  Files          48       47       -1     
  Lines        3915     3885      -30     
  Branches      259      256       -3     
==========================================
- Hits         3832     3817      -15     
+ Misses         62       50      -12     
+ Partials       21       18       -3     
Impacted Files Coverage Δ
src/klein/_app.py 100.00% <100.00%> (+3.50%) ⬆️
src/klein/_isession.py 100.00% <100.00%> (ø)
src/klein/test/test_app.py 98.02% <100.00%> (ø)
src/klein/test/test_resource.py 96.90% <100.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd16480...5bdea21. Read the comment docs.

Copy link
Member

@glyph glyph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I hope you can avoid adding another Deferred-returning test.

src/klein/test/test_resource.py Outdated Show resolved Hide resolved
src/klein/test/test_resource.py Outdated Show resolved Hide resolved
@wsanchez
Copy link
Member Author

wsanchez commented Jun 9, 2020

although I hope you can avoid adding another Deferred-returning test.

For the record, I'm not adding any tests; I'm simply moving a test from one file to another.

@wsanchez wsanchez merged commit 03490d8 into master Jun 9, 2020
@wsanchez wsanchez deleted the py3-test-resource branch June 9, 2020 17:39
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this pull request Jun 20, 2021
Most of patches are home-grown instead of from upstream, as upstream fixes
are quite large and cannot be cleanly backported. Specifically, upstream
moves test strategies from Klein to Hyperlink [1] and drop Python 2.x
support [2,3]. The fix for Werkzeug 2.x in test_resource.py [3] is smaller,
while it cannot be cleanly backported, either.

[1] twisted/klein#393
[2] twisted/klein#328
[3] twisted/klein#355
[4] twisted/klein#499

git-svn-id: file:///srv/repos/svn-community/svn@965883 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this pull request Jun 20, 2021
Most of patches are home-grown instead of from upstream, as upstream fixes
are quite large and cannot be cleanly backported. Specifically, upstream
moves test strategies from Klein to Hyperlink [1] and drop Python 2.x
support [2,3]. The fix for Werkzeug 2.x in test_resource.py [3] is smaller,
while it cannot be cleanly backported, either.

[1] twisted/klein#393
[2] twisted/klein#328
[3] twisted/klein#355
[4] twisted/klein#499



git-svn-id: file:///srv/repos/svn-community/svn@965883 9fca08f4-af9d-4005-b8df-a31f2cc04f65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants