This repository has been archived by the owner on May 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python-klein: add patches to make tests green
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
- Loading branch information
yan12125
authored and
svntogit
committed
Jun 20, 2021
1 parent
835e0d1
commit 8d6082a
Showing
2 changed files
with
80 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
diff -ur klein-20.6.0.orig/src/klein/test/_strategies.py klein-20.6.0/src/klein/test/_strategies.py | ||
--- klein-20.6.0.orig/src/klein/test/_strategies.py 2020-06-08 10:52:04.000000000 +0800 | ||
+++ klein-20.6.0/src/klein/test/_strategies.py 2021-06-20 18:35:54.019437139 +0800 | ||
@@ -24,7 +24,6 @@ | ||
|
||
from idna import IDNAError, check_label, encode as idna_encode | ||
|
||
-from twisted.python.compat import _PY3, unicode | ||
|
||
|
||
__all__ = () | ||
@@ -34,8 +33,9 @@ | ||
DrawCallable = Callable[[Callable[..., T]], T] | ||
|
||
|
||
-if _PY3: | ||
+if True: | ||
unichr = chr | ||
+ unicode = str | ||
|
||
|
||
def idna_characters(): # pragma: no cover | ||
diff -ur klein-20.6.0.orig/src/klein/test/test_resource.py klein-20.6.0/src/klein/test/test_resource.py | ||
--- klein-20.6.0.orig/src/klein/test/test_resource.py 2020-06-08 10:52:04.000000000 +0800 | ||
+++ klein-20.6.0/src/klein/test/test_resource.py 2021-06-20 18:42:53.065083517 +0800 | ||
@@ -13,7 +13,6 @@ | ||
from twisted.internet.defer import CancelledError, Deferred, fail, succeed | ||
from twisted.internet.error import ConnectionLost | ||
from twisted.internet.unix import Server | ||
-from twisted.python.compat import _PY3, unicode | ||
from twisted.trial.unittest import SynchronousTestCase | ||
from twisted.web import server | ||
from twisted.web.http_headers import Headers | ||
@@ -34,6 +33,8 @@ | ||
ensure_utf8_bytes, | ||
) | ||
|
||
+unicode = str | ||
+ | ||
|
||
def requestMock( | ||
path, | ||
@@ -610,7 +611,7 @@ | ||
request.setHeader.assert_has_calls( | ||
[ | ||
call(b"Content-Type", b"text/html; charset=utf-8"), | ||
- call(b"Content-Length", b"259"), | ||
+ call(b"Content-Length", b"258"), | ||
call(b"Location", b"http://localhost:8080/foo/"), | ||
] | ||
) | ||
@@ -1116,7 +1117,7 @@ | ||
repr(_URLDecodeError(ValueError)), | ||
) | ||
|
||
- if _PY3: | ||
+ if True: | ||
test_urlDecodeErrorReprPy2.skip = "Only works on Py2" # type: ignore | ||
else: | ||
test_urlDecodeErrorReprPy3.skip = "Only works on Py3" # type: ignore | ||
@@ -1319,7 +1320,7 @@ | ||
self.assertIdentical(resource.ensure_utf8_bytes, ensure_utf8_bytes) | ||
|
||
|
||
-if _PY3: | ||
+if True: | ||
import sys | ||
|
||
if sys.version_info >= (3, 5): |