From commits-noreply at bitbucket.org Sat Apr 7 14:24:50 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 07 Apr 2012 12:24:50 -0000 Subject: [py-svn] commit/py: 2 new changesets Message-ID: <20120407122450.11425.61369@bitbucket05.managed.contegix.com> 2 new commits in py: https://bitbucket.org/hpk42/py/changeset/fda157fda4c4/ changeset: fda157fda4c4 user: RonnyPfannschmidt date: 2012-04-05 16:10:01 summary: support passing error handler names to py.builtin._totext affected #: 2 files diff -r 2c042feb5b3b1acebc7ceb565cac0a3b72d2a732 -r fda157fda4c4d9f9fa3754805cc141b999efe7f0 py/_builtin.py --- a/py/_builtin.py +++ b/py/_builtin.py @@ -113,9 +113,9 @@ # some backward compatibility helpers _basestring = str - def _totext(obj, encoding=None): + def _totext(obj, encoding=None, errors=None): if isinstance(obj, bytes): - obj = obj.decode(encoding) + obj = obj.decode(encoding, errors) elif not isinstance(obj, str): obj = str(obj) return obj diff -r 2c042feb5b3b1acebc7ceb565cac0a3b72d2a732 -r fda157fda4c4d9f9fa3754805cc141b999efe7f0 testing/root/test_builtin.py --- a/testing/root/test_builtin.py +++ b/testing/root/test_builtin.py @@ -133,6 +133,15 @@ def test_totext(): py.builtin._totext("hello", "UTF-8") +def test_totext_badutf8(): + # this was in printouts within the pytest testsuite + # totext would fail + if sys.version_info >= (3,): + errors = 'surrogateescape' + else: # old python has crappy error handlers + errors = 'replace' + py.builtin._totext("\xa6", "UTF-8", errors) + def test_reraise(): from py.builtin import _reraise try: https://bitbucket.org/hpk42/py/changeset/c909e2794057/ changeset: c909e2794057 user: RonnyPfannschmidt date: 2012-04-05 16:53:42 summary: use the replace handler for stray bytes on stdout/err capture affected #: 2 files diff -r fda157fda4c4d9f9fa3754805cc141b999efe7f0 -r c909e27940574490119488ac0e94daebaa37e1bc py/_io/capture.py --- a/py/_io/capture.py +++ b/py/_io/capture.py @@ -12,7 +12,7 @@ class TextIO(StringIO): def write(self, data): if not isinstance(data, unicode): - data = unicode(data, getattr(self, '_encoding', 'UTF-8')) + data = unicode(data, getattr(self, '_encoding', 'UTF-8'), 'replace') StringIO.write(self, data) else: TextIO = StringIO @@ -260,7 +260,7 @@ res = f.read() enc = getattr(f, 'encoding', None) if enc: - res = py.builtin._totext(res, enc) + res = py.builtin._totext(res, enc, 'replace') f.truncate(0) f.seek(0) l.append(res) diff -r fda157fda4c4d9f9fa3754805cc141b999efe7f0 -r c909e27940574490119488ac0e94daebaa37e1bc testing/io_/test_capture.py --- a/testing/io_/test_capture.py +++ b/testing/io_/test_capture.py @@ -219,6 +219,15 @@ out, err = cap.readouterr() assert out == py.builtin._totext("hx\xc4\x85\xc4\x87\n", "utf8") + @py.test.mark.skipif('sys.version_info >= (3,)', + reason='text output different for bytes on python3') + def test_capturing_readouterr_decode_error_handling(self): + cap = self.getcapture() + # triggered a internal error in pytest + print('\xa6') + out, err = cap.readouterr() + assert out == py.builtin._totext('\ufffd\n', 'unicode-escape') + def test_capturing_mixed(self): cap = self.getcapture(mixed=True) sys.stdout.write("hello ") 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. From commits-noreply at bitbucket.org Sat Apr 7 14:40:51 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 07 Apr 2012 12:40:51 -0000 Subject: [py-svn] commit/py: RonnyPfannschmidt: add windows error 21 - device busy/unavailiable Message-ID: <20120407124051.11422.95939@bitbucket05.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/4919f3a2d859/ changeset: 4919f3a2d859 user: RonnyPfannschmidt date: 2012-04-07 14:40:40 summary: add windows error 21 - device busy/unavailiable affected #: 1 file diff -r c909e27940574490119488ac0e94daebaa37e1bc -r 4919f3a2d859d884c028a9316a68d825aa1df685 py/_error.py --- a/py/_error.py +++ b/py/_error.py @@ -23,6 +23,7 @@ 2: errno.ENOENT, 3: errno.ENOENT, 17: errno.EEXIST, + 21: errno.EBUSY, # empty cd drive, but ENOMEDIUM seems unavailiable 22: errno.ENOTDIR, 267: errno.ENOTDIR, 5: errno.EACCES, # anything better? 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. From commits-noreply at bitbucket.org Sun Apr 8 22:08:52 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sun, 08 Apr 2012 20:08:52 -0000 Subject: [py-svn] commit/py: Ronn...@gmx.de: surprisingly windows error 21 has a errno of 13 Message-ID: <20120408200852.24216.34779@bitbucket12.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/9b7e6fc1ad68/ changeset: 9b7e6fc1ad68 user: Ronn... at gmx.de date: 2012-04-09 08:06:30 summary: surprisingly windows error 21 has a errno of 13 affected #: 1 file diff -r 4919f3a2d859d884c028a9316a68d825aa1df685 -r 9b7e6fc1ad68a7a3ba94c98d71f2961610f8530c py/_error.py --- a/py/_error.py +++ b/py/_error.py @@ -23,7 +23,7 @@ 2: errno.ENOENT, 3: errno.ENOENT, 17: errno.EEXIST, - 21: errno.EBUSY, # empty cd drive, but ENOMEDIUM seems unavailiable + 13: errno.EBUSY, # empty cd drive, but ENOMEDIUM seems unavailiable 22: errno.ENOTDIR, 267: errno.ENOTDIR, 5: errno.EACCES, # anything better? 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. From commits-noreply at bitbucket.org Sun Apr 8 22:52:33 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sun, 08 Apr 2012 20:52:33 -0000 Subject: [py-svn] commit/py: 2 new changesets Message-ID: <20120408205233.3889.50375@bitbucket02.managed.contegix.com> 2 new commits in py: https://bitbucket.org/hpk42/py/changeset/876ac9efe39c/ changeset: 876ac9efe39c user: RonnyPfannschmidt date: 2012-04-09 08:22:51 summary: also handle EBUSY in existence based checks, fixes #15 this should have been ENOMEDIUM, but that isnt exposed on cpython affected #: 1 file diff -r 9b7e6fc1ad68a7a3ba94c98d71f2961610f8530c -r 876ac9efe39c6844b3e64cb7483c2a4c9abfaed3 py/_path/common.py --- a/py/_path/common.py +++ b/py/_path/common.py @@ -64,7 +64,10 @@ else: if bool(value) ^ bool(meth()) ^ invert: return False - except (py.error.ENOENT, py.error.ENOTDIR): + except (py.error.ENOENT, py.error.ENOTDIR, py.error.EBUSY): + # EBUSY feels not entirely correct, + # but its kind of necessary since ENOMEDIUM + # is not accessible in python for name in self._depend_on_existence: if name in kw: if kw.get(name): https://bitbucket.org/hpk42/py/changeset/c21e9a77111e/ changeset: c21e9a77111e user: RonnyPfannschmidt date: 2012-04-08 22:52:15 summary: python3 bytes decoding cant actually handle None as error handler affected #: 1 file diff -r 876ac9efe39c6844b3e64cb7483c2a4c9abfaed3 -r c21e9a77111e770a9139d8e90348c4e6f1ba2eb3 py/_builtin.py --- a/py/_builtin.py +++ b/py/_builtin.py @@ -115,7 +115,10 @@ _basestring = str def _totext(obj, encoding=None, errors=None): if isinstance(obj, bytes): - obj = obj.decode(encoding, errors) + if errors is None: + obj = obj.decode(encoding) + else: + obj = obj.decode(encoding, errors) elif not isinstance(obj, str): obj = str(obj) return obj 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. From commits-noreply at bitbucket.org Fri Apr 13 12:45:11 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 13 Apr 2012 10:45:11 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: fix a import strange loop that affects pypy test appsupport on python2.5 Message-ID: <20120413104511.1475.75681@bitbucket12.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/111f17d50ad8/ changeset: 111f17d50ad8 user: RonnyPfannschmidt date: 2012-04-13 12:41:02 summary: fix a import strange loop that affects pypy test appsupport on python2.5 affected #: 4 files diff -r 4d4ce0192c296472a9cd0ad513d81950e4cc9502 -r 111f17d50ad8d28742b180908286b8f33bf351c3 _pytest/assertion/oldinterpret.py --- a/_pytest/assertion/oldinterpret.py +++ b/_pytest/assertion/oldinterpret.py @@ -1,8 +1,7 @@ import py import sys, inspect from compiler import parse, ast, pycodegen -from _pytest.assertion.util import format_explanation -from _pytest.assertion.reinterpret import BuiltinAssertionError +from _pytest.assertion.util import format_explanation, BuiltinAssertionError passthroughex = py.builtin._sysex diff -r 4d4ce0192c296472a9cd0ad513d81950e4cc9502 -r 111f17d50ad8d28742b180908286b8f33bf351c3 _pytest/assertion/reinterpret.py --- a/_pytest/assertion/reinterpret.py +++ b/_pytest/assertion/reinterpret.py @@ -1,7 +1,6 @@ import sys import py - -BuiltinAssertionError = py.builtin.builtins.AssertionError +from _pytest.assertion.util import BuiltinAssertionError class AssertionError(BuiltinAssertionError): def __init__(self, *args): diff -r 4d4ce0192c296472a9cd0ad513d81950e4cc9502 -r 111f17d50ad8d28742b180908286b8f33bf351c3 _pytest/assertion/util.py --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -2,6 +2,7 @@ import py +BuiltinAssertionError = py.builtin.builtins.AssertionError # The _reprcompare attribute on the util module is used by the new assertion # interpretation code and assertion rewriter to detect this plugin was diff -r 4d4ce0192c296472a9cd0ad513d81950e4cc9502 -r 111f17d50ad8d28742b180908286b8f33bf351c3 testing/test_assertinterpret.py --- a/testing/test_assertinterpret.py +++ b/testing/test_assertinterpret.py @@ -322,3 +322,18 @@ e = exvalue() s = str(e) assert "< 0" in s + + at py.test.mark.skipif("sys.version_info >= (2,6)") +def test_oldinterpret_importation(): + # we had a cyclic import there + # requires pytest on sys.path + res = py.std.subprocess.call([ + py.std.sys.executable, '-c', str(py.code.Source(""" + try: + from _pytest.assertion.newinterpret import interpret + except ImportError: + from _pytest.assertion.oldinterpret import interpret + """)) + ]) + + assert res == 0 Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Wed Apr 18 17:26:54 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 18 Apr 2012 15:26:54 -0000 Subject: [py-svn] commit/pytest: gutworth: don't use octal syntax, since its not py2/py3 compatible Message-ID: <20120418152654.10548.78118@bitbucket02.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/a60ba78ee36d/ changeset: a60ba78ee36d user: gutworth date: 2012-04-18 17:26:44 summary: don't use octal syntax, since its not py2/py3 compatible affected #: 1 file diff -r 111f17d50ad8d28742b180908286b8f33bf351c3 -r a60ba78ee36d2accee0f8991af2be3fddf992790 testing/test_junitxml.py --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -356,7 +356,7 @@ unichr = chr u = py.builtin._totext invalid = (0x00, 0x1, 0xB, 0xC, 0xE, 0x19, - 033, # issue #126 + 27, # issue #126 0xD800, 0xDFFF, 0xFFFE, 0x0FFFF) #, 0x110000) valid = (0x9, 0xA, 0x20,) # 0xD, 0xD7FF, 0xE000, 0xFFFD, 0x10000, 0x10FFFF) Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Wed Apr 18 21:01:59 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 18 Apr 2012 19:01:59 -0000 Subject: [py-svn] commit/py: gutworth: use __new__ instead of __init__ like the classes they mock Message-ID: <20120418190159.14326.24970@bitbucket05.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/af04d88f4d62/ changeset: af04d88f4d62 user: gutworth date: 2012-04-18 21:01:52 summary: use __new__ instead of __init__ like the classes they mock affected #: 1 file diff -r c21e9a77111e770a9139d8e90348c4e6f1ba2eb3 -r af04d88f4d6201296dc17fcc8b67b11c796cb7d9 testing/path/test_svnauth.py --- a/testing/path/test_svnauth.py +++ b/testing/path/test_svnauth.py @@ -90,9 +90,10 @@ '--no-auth-cache --non-interactive') class svnwc_no_svn(py.path.svnwc): - def __init__(self, *args, **kwargs): + def __new__(cls, *args, **kwargs): + self = super(svnwc_no_svn, cls).__new__(cls, *args, **kwargs) self.commands = [] - super(svnwc_no_svn, self).__init__(*args, **kwargs) + return self def _svn(self, *args): self.commands.append(args) @@ -130,9 +131,10 @@ class svnurl_no_svn(py.path.svnurl): cmdexec_output = 'test' popen_output = 'test' - def __init__(self, *args, **kwargs): - py.path.svnurl.__init__(self, *args, **kwargs) + def __new__(cls, *args, **kwargs): + self = super(svnurl_no_svn, cls).__new__(cls, *args, **kwargs) self.commands = [] + return self def _cmdexec(self, cmd): self.commands.append(cmd) 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. From commits-noreply at bitbucket.org Wed Apr 18 21:13:55 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 18 Apr 2012 19:13:55 -0000 Subject: [py-svn] commit/py: gutworth: dynamically creating modules requires invalidating caches in py3.3 Message-ID: <20120418191355.20927.6589@bitbucket01.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/c332ad7033ff/ changeset: c332ad7033ff user: gutworth date: 2012-04-18 21:13:48 summary: dynamically creating modules requires invalidating caches in py3.3 affected #: 1 file diff -r af04d88f4d6201296dc17fcc8b67b11c796cb7d9 -r c332ad7033ffbd9c78b09180efef1cc60029cd23 testing/code/test_excinfo.py --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -5,6 +5,13 @@ failsonjython = py.test.mark.xfail("sys.platform.startswith('java')") +try: + import importlib +except ImportError: + invalidate_import_caches = None +else: + invalidate_import_caches = getattr(importlib, "invalidate_caches", None) + class TWMock: def __init__(self): self.lines = [] @@ -304,6 +311,8 @@ modpath = tmpdir.join("mod.py") tmpdir.ensure("__init__.py") modpath.write(source) + if invalidate_import_caches is not None: + invalidate_import_caches() return modpath.pyimport() return importasmod 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. From commits-noreply at bitbucket.org Fri Apr 27 23:48:36 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 27 Apr 2012 21:48:36 -0000 Subject: [py-svn] commit/py: gutworth: use the non-hacky way of dynamically importing packages Message-ID: <20120427214836.7239.19981@bitbucket02.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/8ea021239dde/ changeset: 8ea021239dde user: gutworth date: 2012-04-27 23:48:27 summary: use the non-hacky way of dynamically importing packages affected #: 2 files diff -r c332ad7033ffbd9c78b09180efef1cc60029cd23 -r 8ea021239dde14ddbc2db02771a86e0035edfbe2 py/_builtin.py --- a/py/_builtin.py +++ b/py/_builtin.py @@ -231,7 +231,9 @@ assert names for name in names: try: - return __import__(name, None, None, '__doc__') + __import__(name) except ImportError: excinfo = sys.exc_info() + else: + return sys.modules[name] _reraise(*excinfo) diff -r c332ad7033ffbd9c78b09180efef1cc60029cd23 -r 8ea021239dde14ddbc2db02771a86e0035edfbe2 py/_path/local.py --- a/py/_path/local.py +++ b/py/_path/local.py @@ -517,7 +517,8 @@ if pkgpath is not None: if ensuresyspath: self._prependsyspath(pkgpath.dirpath()) - pkg = __import__(pkgpath.basename, None, None, []) + __import__(pkgpath.basename) + pkg = sys.modules[pkgpath.basename] names = self.new(ext='').relto(pkgpath.dirpath()) names = names.split(self.sep) if names and names[-1] == "__init__": @@ -528,7 +529,8 @@ if ensuresyspath: self._prependsyspath(self.dirpath()) modname = self.purebasename - mod = __import__(modname, None, None, ['__doc__']) + __import__(modname) + mod = sys.modules[modname] if self.basename == "__init__.py": return mod # we don't check anything as we might # we in a namespace package ... too icky to check 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. From commits-noreply at bitbucket.org Fri Apr 27 23:51:57 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 27 Apr 2012 21:51:57 -0000 Subject: [py-svn] commit/pytest: gutworth: use non-hacky dynamic package import method Message-ID: <20120427215157.7241.23130@bitbucket02.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/cb46ab12f794/ changeset: cb46ab12f794 user: gutworth date: 2012-04-27 23:51:50 summary: use non-hacky dynamic package import method affected #: 2 files diff -r a60ba78ee36d2accee0f8991af2be3fddf992790 -r cb46ab12f7948bc1087ede40c3144a37407a3878 _pytest/core.py --- a/_pytest/core.py +++ b/_pytest/core.py @@ -321,13 +321,15 @@ name = importspec try: mod = "_pytest." + name - return __import__(mod, None, None, '__doc__') + __import__(mod) + return sys.modules[mod] except ImportError: #e = py.std.sys.exc_info()[1] #if str(e).find(name) == -1: # raise pass # - return __import__(importspec, None, None, '__doc__') + __import__(importspec) + return sys.modules[importspec] class MultiCall: """ execute a call into multiple python functions/methods. """ diff -r a60ba78ee36d2accee0f8991af2be3fddf992790 -r cb46ab12f7948bc1087ede40c3144a37407a3878 _pytest/runner.py --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -416,9 +416,10 @@ __tracebackhide__ = True compile(modname, '', 'eval') # to catch syntaxerrors try: - mod = __import__(modname, None, None, ['__doc__']) + __import__(modname) except ImportError: py.test.skip("could not import %r" %(modname,)) + mod = sys.modules[modname] if minversion is None: return mod verattr = getattr(mod, '__version__', None) Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.