[py-svn] commit/py: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Tue Jul 12 19:48:39 CEST 2011


2 new changesets in py:

http://bitbucket.org/hpk42/py/changeset/d4f180eb9dde/
changeset:   d4f180eb9dde
user:        hpk42
date:        2011-07-09 12:02:53
summary:     Added tag 1.4.4 for changeset d9951e3bdbc7
affected #:  1 file (47 bytes)

--- a/.hgtags	Sat Jul 09 10:08:27 2011 +0200
+++ b/.hgtags	Sat Jul 09 12:02:53 2011 +0200
@@ -35,3 +35,4 @@
 1f3125cba7976538952be268f107c1d0c36c5ce8 1.4.1
 04ab22db4ff737cf31e91d75a0f5d7077f324167 1.4.2
 9950bf9d684a984d511795013421c89c5cf88bef 1.4.3
+d9951e3bdbc765e73835ae13012f6a074d13d8bf 1.4.4


http://bitbucket.org/hpk42/py/changeset/df4cc184ff65/
changeset:   df4cc184ff65
user:        hpk42
date:        2011-07-12 19:48:31
summary:     improve unicode handling
affected #:  7 files (777 bytes)

--- a/CHANGELOG	Sat Jul 09 12:02:53 2011 +0200
+++ b/CHANGELOG	Tue Jul 12 19:48:31 2011 +0200
@@ -1,3 +1,9 @@
+Changes between 1.4.4 and 1.4.5.dev1
+==================================================
+
+- improve some unicode handling in terminalwriter and capturing
+  (used by pytest)
+
 Changes between 1.4.3 and 1.4.4
 ==================================================
 


--- a/py/__init__.py	Sat Jul 09 12:02:53 2011 +0200
+++ b/py/__init__.py	Tue Jul 12 19:48:31 2011 +0200
@@ -8,7 +8,7 @@
 
 (c) Holger Krekel and others, 2004-2010
 """
-__version__ = '1.4.4'
+__version__ = '1.4.5.dev1'
 
 from py import _apipkg
 


--- a/py/_io/capture.py	Sat Jul 09 12:02:53 2011 +0200
+++ b/py/_io/capture.py	Tue Jul 12 19:48:31 2011 +0200
@@ -258,6 +258,9 @@
                 f = getattr(self, name).tmpfile
                 f.seek(0)
                 res = f.read()
+                enc = getattr(f, 'encoding', None)
+                if enc:
+                    res = py.builtin._totext(res, enc)
                 f.truncate(0)
                 f.seek(0)
             l.append(res)


--- a/py/_io/terminalwriter.py	Sat Jul 09 12:02:53 2011 +0200
+++ b/py/_io/terminalwriter.py	Tue Jul 12 19:48:31 2011 +0200
@@ -112,11 +112,9 @@
                 self.stringio = file = py.io.TextIO()
             else:
                 file = py.std.sys.stdout
-                if hasattr(file, 'encoding'):
-                    encoding = file.encoding
         elif hasattr(file, '__call__'):
             file = WriteFile(file, encoding=encoding)
-        self.encoding = encoding
+        self.encoding = encoding or getattr(file, 'encoding', "utf-8")
         self._file = file
         self.fullwidth = get_terminal_width()
         self.hasmarkup = should_do_markup(file)


--- a/setup.py	Sat Jul 09 12:02:53 2011 +0200
+++ b/setup.py	Tue Jul 12 19:48:31 2011 +0200
@@ -12,7 +12,7 @@
         name='py',
         description='library with cross-python path, ini-parsing, io, code, log facilities',
         long_description = open('README.txt').read(),
-        version='1.4.4',
+        version='1.4.5.dev1',
         url='http://pylib.org',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
@@ -40,4 +40,4 @@
     )
 
 if __name__ == '__main__':
-    main()
+    main()
\ No newline at end of file


--- a/testing/io_/test_capture.py	Sat Jul 09 12:02:53 2011 +0200
+++ b/testing/io_/test_capture.py	Tue Jul 12 19:48:31 2011 +0200
@@ -213,6 +213,12 @@
             out, err = cap.reset()
         assert err == "error2"
 
+    def test_capturing_readouterr_unicode(self):
+        cap = self.getcapture()
+        print ("hx\xc4\x85\xc4\x87")
+        out, err = cap.readouterr()
+        assert out == py.builtin._totext("hx\xc4\x85\xc4\x87\n", "utf8")
+
     def test_capturing_mixed(self):
         cap = self.getcapture(mixed=True)
         sys.stdout.write("hello ")


--- a/testing/io_/test_terminalwriter.py	Sat Jul 09 12:02:53 2011 +0200
+++ b/testing/io_/test_terminalwriter.py	Tue Jul 12 19:48:31 2011 +0200
@@ -62,6 +62,11 @@
     finally:
         monkeypatch.undo()
 
+def test_terminalwriter_file_unicode(tmpdir):
+    f = py.std.codecs.open(str(tmpdir.join("xyz")), "wb", "utf8")
+    tw = py.io.TerminalWriter(file=f)
+    assert tw.encoding == "utf8"
+
 def test_unicode_encoding():
     msg = py.builtin._totext('b\u00f6y', 'utf8')
     for encoding in 'utf8', 'latin1':

Repository URL: https://bitbucket.org/hpk42/py/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list