public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/webencodings/files/, dev-python/webencodings/
@ 2016-01-18  8:44 Justin Lecher
  0 siblings, 0 replies; only message in thread
From: Justin Lecher @ 2016-01-18  8:44 UTC (permalink / raw
  To: gentoo-commits

commit:     9d3711c161ca9b752d31b3e18b8496771fa5dfdc
Author:     Justin Lecher <jlec <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 08:29:45 2016 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 08:44:48 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d3711c1

dev-python/webencodings: Backport patch to fix tests

Package-Manager: portage-2.2.26
Signed-off-by: Justin Lecher <jlec <AT> gentoo.org>

 .../files/webencodings-0.4-test-fix-backport.patch | 71 ++++++++++++++++++++++
 dev-python/webencodings/webencodings-0.4.ebuild    | 11 +++-
 2 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/dev-python/webencodings/files/webencodings-0.4-test-fix-backport.patch b/dev-python/webencodings/files/webencodings-0.4-test-fix-backport.patch
new file mode 100644
index 0000000..4b42bb1
--- /dev/null
+++ b/dev-python/webencodings/files/webencodings-0.4-test-fix-backport.patch
@@ -0,0 +1,71 @@
+From 87044de0d2640cf9a8f941dec1fc79c679e7fa2d Mon Sep 17 00:00:00 2001
+From: Geoffrey Sneddon <me@gsnedders.com>
+Date: Sun, 17 Jan 2016 16:50:58 +0100
+Subject: [PATCH] Fix #2: get tests passing again after decode API change
+
+---
+ webencodings/tests.py | 36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/webencodings/tests.py b/webencodings/tests.py
+index e0297d9..b8c5653 100644
+--- a/webencodings/tests.py
++++ b/webencodings/tests.py
+@@ -47,7 +47,7 @@ def test_labels():
+ 
+ def test_all_labels():
+     for label in LABELS:
+-        assert decode(b'', label) == ''
++        assert decode(b'', label) == ('', lookup(label))
+         assert encode('', label) == b''
+         for repeat in [0, 1, 12]:
+             output, _ = iter_decode([b''] * repeat, label)
+@@ -74,25 +74,25 @@ def test_invalid_label():
+ 
+ 
+ def test_decode():
+-    assert decode(b'\x80', 'latin1') == '€'
+-    assert decode(b'\x80', lookup('latin1')) == '€'
+-    assert decode(b'\xc3\xa9', 'utf8') == 'é'
+-    assert decode(b'\xc3\xa9', UTF8) == 'é'
+-    assert decode(b'\xc3\xa9', 'ascii') == 'é'
+-    assert decode(b'\xEF\xBB\xBF\xc3\xa9', 'ascii') == 'é'  # UTF-8 with BOM
++    assert decode(b'\x80', 'latin1') == ('€', lookup('latin1'))
++    assert decode(b'\x80', lookup('latin1')) == ('€', lookup('latin1'))
++    assert decode(b'\xc3\xa9', 'utf8') == ('é', lookup('utf8'))
++    assert decode(b'\xc3\xa9', UTF8) == ('é', lookup('utf8'))
++    assert decode(b'\xc3\xa9', 'ascii') == ('é', lookup('ascii'))
++    assert decode(b'\xEF\xBB\xBF\xc3\xa9', 'ascii') == ('é', lookup('utf8'))  # UTF-8 with BOM
+ 
+-    assert decode(b'\xFE\xFF\x00\xe9', 'ascii') == 'é'  # UTF-16-BE with BOM
+-    assert decode(b'\xFF\xFE\xe9\x00', 'ascii') == 'é'  # UTF-16-LE with BOM
+-    assert decode(b'\xFE\xFF\xe9\x00', 'ascii') == '\ue900'
+-    assert decode(b'\xFF\xFE\x00\xe9', 'ascii') == '\ue900'
++    assert decode(b'\xFE\xFF\x00\xe9', 'ascii') == ('é', lookup('utf-16be'))  # UTF-16-BE with BOM
++    assert decode(b'\xFF\xFE\xe9\x00', 'ascii') == ('é', lookup('utf-16le'))  # UTF-16-LE with BOM
++    assert decode(b'\xFE\xFF\xe9\x00', 'ascii') == ('\ue900', lookup('utf-16be'))
++    assert decode(b'\xFF\xFE\x00\xe9', 'ascii') == ('\ue900', lookup('utf-16le'))
+ 
+-    assert decode(b'\x00\xe9', 'UTF-16BE') == 'é'
+-    assert decode(b'\xe9\x00', 'UTF-16LE') == 'é'
+-    assert decode(b'\xe9\x00', 'UTF-16') == 'é'
++    assert decode(b'\x00\xe9', 'UTF-16BE') == ('é', lookup('utf-16be'))
++    assert decode(b'\xe9\x00', 'UTF-16LE') == ('é', lookup('utf-16le'))
++    assert decode(b'\xe9\x00', 'UTF-16') == ('é', lookup('utf-16le'))
+ 
+-    assert decode(b'\xe9\x00', 'UTF-16BE') == '\ue900'
+-    assert decode(b'\x00\xe9', 'UTF-16LE') == '\ue900'
+-    assert decode(b'\x00\xe9', 'UTF-16') == '\ue900'
++    assert decode(b'\xe9\x00', 'UTF-16BE') == ('\ue900', lookup('utf-16be'))
++    assert decode(b'\x00\xe9', 'UTF-16LE') == ('\ue900', lookup('utf-16le'))
++    assert decode(b'\x00\xe9', 'UTF-16') == ('\ue900', lookup('utf-16le'))
+ 
+ 
+ def test_encode():
+@@ -149,5 +149,5 @@ def test_x_user_defined():
+     decoded = '2,\x0c\x0b\x1aO\uf7d9#\uf7cb\x0f\uf7c9\uf7bbt\uf7cf\uf7a8\uf7ca'
+     encoded = b'aa'
+     decoded = 'aa'
+-    assert decode(encoded, 'x-user-defined') == decoded
++    assert decode(encoded, 'x-user-defined') == (decoded, lookup('x-user-defined'))
+     assert encode(decoded, 'x-user-defined') == encoded

diff --git a/dev-python/webencodings/webencodings-0.4.ebuild b/dev-python/webencodings/webencodings-0.4.ebuild
index 219c182..7898dc6 100644
--- a/dev-python/webencodings/webencodings-0.4.ebuild
+++ b/dev-python/webencodings/webencodings-0.4.ebuild
@@ -24,13 +24,18 @@ DEPEND="${REDEPEND}
 		dev-python/pytest[${PYTHON_USEDEP}]
 	)"
 
-# https://github.com/SimonSapin/python-webencodings/issues/2
-RESTRICT=test
+PATCHES=(
+	"${FILESDIR}"/${P}-test-fix-backport.patch
+)
 
-python_test() {
+python_prepare_all(){
 	cat >> setup.cfg <<- EOF
 	[pytest]
 	python_files=test*.py
 	EOF
+	distutils-r1_python_prepare_all
+}
+
+python_test() {
 	py.test -v -v || die
 }


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-18  8:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-18  8:44 [gentoo-commits] repo/gentoo:master commit in: dev-python/webencodings/files/, dev-python/webencodings/ Justin Lecher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox