pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
py-lxml-3.5.0 and utf-8 paths
I'm curious if any other platforms (or all) experience issues on utf-8 filesystems (sys.getfilesystemencoding() == 'utf-8')
> ======================================================================
> ERROR: test_etree_parse_io_error (lxml.tests.test_io.ETreeIOTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/opt/local/lib/python2.7/unittest/case.py", line 329, in run
> testMethod()
> File "/tmp/pkgsrc/textproc/py-lxml/work/lxml-3.5.0/src/lxml/tests/test_io.py", line 276, in test_etree_parse_io_error
> dn = tempfile.mkdtemp(prefix=dirnameRU)
> File "/opt/local/lib/python2.7/tempfile.py", line 339, in mkdtemp
> _os.mkdir(file, 0700)
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 40-53: ordinal not in range(128)
>
I attach a workaround that seems to work for my platform (SunOS) but am concerned about whether this
is something that needs to be adressed in Python.. notably for tempfile and any other path/filename manipulations.
I don't believe that the setting of LANG=C in ALL_ENV is the culprit, as I tried forcing to a UTF-8 locale for
running the test suite in $WRKSRC/Makefile to no avail.
Although the issue came up with python27, it persists with python35...
Can anybody run successfully the testsuite without the attached patchset, and under what platforms/conditions?
--
Richard PALO
From 122fb175adcd1cbeef363df2439827b2fcee1ef5 Mon Sep 17 00:00:00 2001
From: Richard PALO <richard%NetBSD.org@localhost>
Date: Sat, 2 Jan 2016 09:06:37 +0100
Subject: [PATCH] utf-8 encoding workaround for py-lxml testsuite
---
textproc/py-lxml/distinfo | 1 +
.../py-lxml/patches/patch-src_lxml_tests_test__io.py | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
create mode 100644 textproc/py-lxml/patches/patch-src_lxml_tests_test__io.py
diff --git a/textproc/py-lxml/distinfo b/textproc/py-lxml/distinfo
index 25f46ce..71a669d 100644
--- a/textproc/py-lxml/distinfo
+++ b/textproc/py-lxml/distinfo
@@ -4,3 +4,4 @@ SHA1 (lxml-3.5.0.tgz) = c09676c0fda8897030d6ba7bed0987f50cad89cc
RMD160 (lxml-3.5.0.tgz) = b6f1e849045fd28cf1f11b3442c7608c4c02f5cf
SHA512 (lxml-3.5.0.tgz) = 9b728642bec22be39aef603050121715521603a50bc01d3851e1eb7bfc6302c991da3a3bdebfdeaa9038e19fe39d8286f60851fecf1c4e85469f0ed8fa6e9368
Size (lxml-3.5.0.tgz) = 3810202 bytes
+SHA1 (patch-src_lxml_tests_test__io.py) = 58210685e65e2441d37e6485b4e0a635270fac73
diff --git a/textproc/py-lxml/patches/patch-src_lxml_tests_test__io.py b/textproc/py-lxml/patches/patch-src_lxml_tests_test__io.py
new file mode 100644
index 0000000..3362855
--- /dev/null
+++ b/textproc/py-lxml/patches/patch-src_lxml_tests_test__io.py
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- src/lxml/tests/test_io.py.orig 2014-02-26 19:36:12.000000000 +0000
++++ src/lxml/tests/test_io.py
+@@ -273,9 +273,9 @@ class _IOTestCaseBase(HelperTestCase):
+ self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename))
+ finally:
+ os.rmdir(dn)
+- dn = tempfile.mkdtemp(prefix=dirnameRU)
++ dn = tempfile.mkdtemp(prefix=dirnameRU.encode('utf-8'))
+ try:
+- self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename))
++ self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename.encode('utf-8')))
+ finally:
+ os.rmdir(dn)
+
--
2.6.4
Home |
Main Index |
Thread Index |
Old Index