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
Conversation
Remove code for Twisted < 16.6, which is now well beyond it's support window.
|
||
try: | ||
from inspect import iscoroutine | ||
except ImportError: | ||
|
||
def iscoroutine(*args, **kwargs): # type: ignore | ||
return 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.
We can assume iscoroutine
is available; added in Python 3.5.
try: | ||
from twisted.internet.defer import ensureDeferred | ||
except ImportError: | ||
|
||
def ensureDeferred(*args, **kwagrs): | ||
raise NotImplementedError("Coroutines support requires Twisted>=16.6") | ||
|
||
|
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.
Twisted <16.6 hasn't been on our test matrix for some time
try: | ||
from constantly import NamedConstant, Names | ||
except ImportError: # pragma: no cover | ||
from twisted.python.constants import NamedConstant, Names |
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.
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 Report
@@ 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
Continue to review full report at Codecov.
|
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.
LGTM, 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. |
Put LeafResource content into a class variable.
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
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
Merge
py3_test_resource.py
intotest_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.