[pypy-commit] pypy py3.5: Fight a lot but come to a conclusion: this extra int_lt() makes a bit of sense after all
Author: Armin Rigo
Branch: py3.5
Changeset: r88381:db0d9c895763
Date: 2016-11-15 09:48 +0100
http://bitbucket.org/pypy/pypy/changeset/db0d9c895763/
Log:Fight a lot but come to a conclusion: this extra int_lt() makes a
bit of sense after all
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py
b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -143,13 +143,21 @@
loop, = log.loops_by_filename(self.filepath)
assert loop.match("""
guard_not_invalidated?
-i16 = int_ge(i11, i12)
-guard_false(i16, descr=...)
+# W_IntRangeStepOneIterator.next()
+i16 = int_lt(i11, i12)
+guard_true(i16, descr=...)
i20 = int_add(i11, 1)
-setfield_gc(p4, i20, descr=<.*
.*W_AbstractSeqIterObject.inst_index .*>)
+setfield_gc(p4, i20, descr=<.* .*W_IntRangeIterator.inst_current
.*>)
guard_not_invalidated?
i21 = force_token()
i88 = int_sub(i9, 1)
+
+# Compared with pypy2, we get these two operations extra.
+# I think the reason is that W_IntRangeStepOneIterator is used
+# for any 'start' value, which might be negative.
+i89 = int_lt(i11, 0)
+guard_false(i89, descr=...)
+
i25 = int_ge(i11, i9)
guard_false(i25, descr=...)
i27 = int_add_ovf(i7, i11)
___
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: test_range_iter_normal
Author: Armin Rigo
Branch: py3.5
Changeset: r88382:33f878c5137c
Date: 2016-11-15 09:54 +0100
http://bitbucket.org/pypy/pypy/changeset/33f878c5137c/
Log:test_range_iter_normal
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py
b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -141,7 +141,9 @@
log = self.run(main, [1000])
assert log.result == 1000 * 999 / 2
loop, = log.loops_by_filename(self.filepath)
-assert loop.match("""
+assert loop.match(self.RANGE_ITER_STEP_1)
+
+RANGE_ITER_STEP_1 = """
guard_not_invalidated?
# W_IntRangeStepOneIterator.next()
i16 = int_lt(i11, i12)
@@ -164,9 +166,12 @@
guard_no_overflow(descr=...)
--TICK--
jump(..., descr=...)
-""")
+"""
def test_range_iter_normal(self):
+# Difference: range(n) => range(1, n).
+# This difference doesn't really change anything in pypy3.5,
+# but it used to in pypy2.7.
def main(n):
def g(n):
return range(n)
@@ -180,26 +185,7 @@
log = self.run(main, [1000])
assert log.result == 1000 * 999 / 2
loop, = log.loops_by_filename(self.filepath)
-assert loop.match("""
-guard_not_invalidated?
-i16 = int_ge(i11, i12)
-guard_false(i16, descr=...)
-i17 = int_mul(i11, i14)
-i18 = int_add(i15, i17)
-i20 = int_add(i11, 1)
-setfield_gc(p4, i20, descr=<.*
.*W_AbstractSeqIterObject.inst_index .*>)
-guard_not_invalidated?
-i21 = force_token()
-i95 = int_sub(i9, 1)
-i23 = int_lt(i18, 0)
-guard_false(i23, descr=...)
-i25 = int_ge(i18, i9)
-guard_false(i25, descr=...)
-i27 = int_add_ovf(i7, i18)
-guard_no_overflow(descr=...)
---TICK--
-jump(..., descr=...)
-""")
+assert loop.match(self.RANGE_ITER_STEP_1)
def test_chain_of_guards(self):
src = """
___
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Move the loop out of space.wrap()
Author: Armin Rigo
Branch: py3.5
Changeset: r88383:c7dfd649a692
Date: 2016-11-15 10:06 +0100
http://bitbucket.org/pypy/pypy/changeset/c7dfd649a692/
Log:Move the loop out of space.wrap()
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -155,18 +155,7 @@
try:
unicode_x = x.decode('ascii')
except UnicodeDecodeError:
-# poor man's x.decode('ascii', 'replace'), since it's not
-# supported by RPython
-if not we_are_translated():
-print 'WARNING: space.wrap() called on a non-ascii byte
string: %r' % x
-lst = []
-for ch in x:
-ch = ord(ch)
-if ch > 127:
-lst.append(u'\ufffd')
-else:
-lst.append(unichr(ch))
-unicode_x = u''.join(lst)
+unicode_x = self._wrap_ascii_replace(x)
return self.newunicode(unicode_x)
if isinstance(x, unicode):
return self.newunicode(x)
@@ -191,6 +180,22 @@
return W_LongObject.fromrarith_int(x)
return self._wrap_not_rpython(x)
+def _wrap_ascii_replace(self, x):
+# XXX should disappear soon?
+# poor man's x.decode('ascii', 'replace'), since it's not
+# supported by RPython
+if not we_are_translated():
+print 'WARNING: space.wrap() called on a non-ascii byte string:
%r' % x
+lst = []
+for ch in x:
+ch = ord(ch)
+if ch > 127:
+lst.append(u'\ufffd')
+else:
+lst.append(unichr(ch))
+unicode_x = u''.join(lst)
+return unicode_x
+
def _wrap_not_rpython(self, x):
"NOT_RPYTHON"
# _ this code is here to support testing only _
___
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Import cffi 1.9.1 (no difference from 1.9.0)
Author: Armin Rigo
Branch:
Changeset: r88384:a98b2c149e2d
Date: 2016-11-15 10:13 +0100
http://bitbucket.org/pypy/pypy/changeset/a98b2c149e2d/
Log:Import cffi 1.9.1 (no difference from 1.9.0)
diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO
--- a/lib_pypy/cffi.egg-info/PKG-INFO
+++ b/lib_pypy/cffi.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: cffi
-Version: 1.9.0
+Version: 1.9.1
Summary: Foreign Function Interface for Python calling C code.
Home-page: http://cffi.readthedocs.org
Author: Armin Rigo, Maciej Fijalkowski
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -4,8 +4,8 @@
from .api import FFI, CDefError, FFIError
from .ffiplatform import VerificationError, VerificationMissing
-__version__ = "1.9.0"
-__version_info__ = (1, 9, 0)
+__version__ = "1.9.1"
+__version_info__ = (1, 9, 1)
# The verifier module file names are based on the CRC32 of a string that
# contains the following version number. It may be older than __version__
diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h
--- a/lib_pypy/cffi/_embedding.h
+++ b/lib_pypy/cffi/_embedding.h
@@ -233,7 +233,7 @@
f = PySys_GetObject((char *)"stderr");
if (f != NULL && f != Py_None) {
PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
- "\ncompiled with cffi version: 1.9.0"
+ "\ncompiled with cffi version: 1.9.1"
"\n_cffi_backend module: ", f);
modules = PyImport_GetModuleDict();
mod = PyDict_GetItemString(modules, "_cffi_backend");
diff --git a/pypy/module/_cffi_backend/__init__.py
b/pypy/module/_cffi_backend/__init__.py
--- a/pypy/module/_cffi_backend/__init__.py
+++ b/pypy/module/_cffi_backend/__init__.py
@@ -3,7 +3,7 @@
from rpython.rlib import rdynload, clibffi, entrypoint
from rpython.rtyper.lltypesystem import rffi
-VERSION = "1.9.0"
+VERSION = "1.9.1"
FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI
try:
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1,7 +1,7 @@
#
import sys
-assert __version__ == "1.9.0", ("This test_c.py file is for testing a version"
+assert __version__ == "1.9.1", ("This test_c.py file is for testing a version"
" of cffi that differs from the one that we"
" get from 'import _cffi_backend'")
if sys.version_info < (3,):
___
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy.org extradoc: Emphasis on "development version *of NumPy*". It's too easy to misread
Author: Armin Rigo Branch: extradoc Changeset: r821:4a9ba4dfb1d7 Date: 2016-11-15 10:42 +0100 http://bitbucket.org/pypy/pypy.org/changeset/4a9ba4dfb1d7/ Log:Emphasis on "development version *of NumPy*". It's too easy to misread "of PyPy". diff --git a/download.html b/download.html --- a/download.html +++ b/download.html @@ -115,7 +115,7 @@ -Python2.7 compatible PyPy 5.6.0 +Python2.7 compatible PyPy 5.6.0 https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.6.0-linux32.tar.bz2";>Linux x86 binary (32bit, tar.bz2 built on Ubuntu 12.04 - 14.04) (see [1] below) https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.6.0-linux64.tar.bz2";>Linux x86-64 binary (64bit, tar.bz2 built on Ubuntu 12.04 - 14.04) (see [1] below) @@ -228,8 +228,10 @@ the Python side and NumPy objects are mediated through the slower cpyext layer (which hurts a few benchmarks that do a lot of element-by-element array accesses, for example). -Installation works using the current developement version of NumPy, since -PyPy specific changes have been merged but not in a release version. +Installation works on any recent PyPy (the release above is fine), +but you need the current developement version of NumPy. The reason +is that some PyPy-specific fixes have been merged back into NumPy, +and they are not yet in a released version of NumPy. For example, without using a virtualenv: $ ./pypy-xxx/bin/pypy -m ensurepip diff --git a/source/download.txt b/source/download.txt --- a/source/download.txt +++ b/source/download.txt @@ -76,6 +76,8 @@ .. _`portable Linux binaries`: https://github.com/squeaky-pl/portable-pypy#portable-pypy-distribution-for-linux +.. _release: + Python2.7 compatible PyPy 5.6.0 --- @@ -251,8 +253,10 @@ layer (which hurts a few benchmarks that do a lot of element-by-element array accesses, for example). -Installation works using the current developement version of NumPy, since -PyPy specific changes have been merged but not in a release version. +Installation works on any recent PyPy (the release_ above is fine), +but you need the current developement version *of NumPy*. The reason +is that some PyPy-specific fixes have been merged back into NumPy, +and they are not yet in a released version of NumPy. For example, without using a virtualenv:: $ ./pypy-xxx/bin/pypy -m ensurepip ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5: Fix test_clear_locals() from cbba0303793c
Author: Armin Rigo Branch: py3.5 Changeset: r88385:6299e1a8556b Date: 2016-11-15 10:43 +0100 http://bitbucket.org/pypy/pypy/changeset/6299e1a8556b/ Log:Fix test_clear_locals() from cbba0303793c diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py --- a/pypy/interpreter/pyframe.py +++ b/pypy/interpreter/pyframe.py @@ -962,7 +962,12 @@ # clear the locals, including the cell/free vars, and the stack for i in range(len(self.locals_cells_stack_w)): -self.locals_cells_stack_w[i] = None +w_oldvalue = self.locals_cells_stack_w[i] +if isinstance(w_oldvalue, Cell): +w_newvalue = Cell() +else: +w_newvalue = None +self.locals_cells_stack_w[i] = w_newvalue self.valuestackdepth = 0 def _convert_unexpected_exception(self, e): ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy space-newtext: three more in _socket
Author: Carl Friedrich Bolz Branch: space-newtext Changeset: r88386:27a8f3f8230c Date: 2016-11-11 18:17 +0100 http://bitbucket.org/pypy/pypy/changeset/27a8f3f8230c/ Log:three more in _socket diff --git a/pypy/module/_socket/interp_socket.py b/pypy/module/_socket/interp_socket.py --- a/pypy/module/_socket/interp_socket.py +++ b/pypy/module/_socket/interp_socket.py @@ -24,8 +24,8 @@ elif isinstance(addr, rsocket.INET6Address): return space.newtuple([space.newtext(addr.get_host()), space.newint(addr.get_port()), - space.wrap(addr.get_flowinfo()), # YYY - space.wrap(addr.get_scope_id())]) # YYY + space.newint(addr.get_flowinfo()), + space.newint(addr.get_scope_id())]) elif rsocket.HAS_AF_PACKET and isinstance(addr, rsocket.PacketAddress): return space.newtuple([space.newtext(addr.get_ifname(fd)), space.newint(addr.get_protocol()), @@ -556,7 +556,7 @@ if value_ptr: lltype.free(value_ptr, flavor='raw') -return space.wrap(recv_ptr[0]) # YYY +return space.newint(recv_ptr[0]) finally: lltype.free(recv_ptr, flavor='raw') ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy space-newtext: fix two typos in the array module
Author: Carl Friedrich Bolz Branch: space-newtext Changeset: r88387:0292533aef1d Date: 2016-11-15 14:49 +0100 http://bitbucket.org/pypy/pypy/changeset/0292533aef1d/ Log:fix two typos in the array module diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py --- a/pypy/module/array/interp_array.py +++ b/pypy/module/array/interp_array.py @@ -57,7 +57,7 @@ def descr_typecode(space, self): -return space.newint(self.typecode) +return space.newtext(self.typecode) arr_eq_driver = jit.JitDriver(name='array_eq_driver', greens=['comp_func'], reds='auto') @@ -272,7 +272,7 @@ elems = max(0, len(item) - (len(item) % self.itemsize)) if n != 0: item = item[0:elems] -self.descr_fromstring(space, space.newint(item)) +self.descr_fromstring(space, space.newbytes(item)) raise oefmt(space.w_EOFError, "not enough items in file") self.descr_fromstring(space, w_item) ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5-ssl: copy Lib/ssl.py from cpython. Pass lots of more tests in test_ssl.py
Author: Richard Plangger
Branch: py3.5-ssl
Changeset: r88388:cdbfa886bf3b
Date: 2016-11-15 15:59 +0100
http://bitbucket.org/pypy/pypy/changeset/cdbfa886bf3b/
Log:copy Lib/ssl.py from cpython. Pass lots of more tests in test_ssl.py
diff --git a/lib-python/3/ssl.py b/lib-python/3/ssl.py
--- a/lib-python/3/ssl.py
+++ b/lib-python/3/ssl.py
@@ -145,6 +145,7 @@
from socket import SOL_SOCKET, SO_TYPE
import base64# for DER-to-PEM translation
import errno
+import warnings
socket_error = OSError # keep that public name in module namespace
@@ -405,12 +406,16 @@
def _load_windows_store_certs(self, storename, purpose):
certs = bytearray()
-for cert, encoding, trust in enum_certificates(storename):
-# CA certs are never PKCS#7 encoded
-if encoding == "x509_asn":
-if trust is True or purpose.oid in trust:
-certs.extend(cert)
-self.load_verify_locations(cadata=certs)
+try:
+for cert, encoding, trust in enum_certificates(storename):
+# CA certs are never PKCS#7 encoded
+if encoding == "x509_asn":
+if trust is True or purpose.oid in trust:
+certs.extend(cert)
+except PermissionError:
+warnings.warn("unable to enumerate Windows certificate store")
+if certs:
+self.load_verify_locations(cadata=certs)
return certs
def load_default_certs(self, purpose=Purpose.SERVER_AUTH):
@@ -560,7 +565,7 @@
server hostame is set."""
return self._sslobj.server_hostname
-def read(self, len=0, buffer=None):
+def read(self, len=1024, buffer=None):
"""Read up to 'len' bytes from the SSL object and return them.
If 'buffer' is provided, read into this buffer and return the number of
@@ -569,7 +574,7 @@
if buffer is not None:
v = self._sslobj.read(len, buffer)
else:
-v = self._sslobj.read(len or 1024)
+v = self._sslobj.read(len)
return v
def write(self, data):
@@ -745,7 +750,8 @@
# non-blocking
raise ValueError("do_handshake_on_connect should not
be specified for non-blocking sockets")
self.do_handshake()
-except:
+
+except (OSError, ValueError):
self.close()
raise
@@ -774,7 +780,7 @@
# EAGAIN.
self.getpeername()
-def read(self, len=0, buffer=None):
+def read(self, len=1024, buffer=None):
"""Read up to LEN bytes and return them.
Return zero-length string on EOF."""
diff --git a/lib-python/3/test/test_ssl.py b/lib-python/3/test/test_ssl.py
--- a/lib-python/3/test/test_ssl.py
+++ b/lib-python/3/test/test_ssl.py
@@ -2889,8 +2889,10 @@
# will be full and the call will block
buf = bytearray(8192)
def fill_buffer():
+i = 0
while True:
s.send(buf)
+i += 1
self.assertRaises((ssl.SSLWantWriteError,
ssl.SSLWantReadError), fill_buffer)
diff --git a/lib_pypy/openssl/_cffi_src/openssl/ssl.py
b/lib_pypy/openssl/_cffi_src/openssl/ssl.py
--- a/lib_pypy/openssl/_cffi_src/openssl/ssl.py
+++ b/lib_pypy/openssl/_cffi_src/openssl/ssl.py
@@ -25,6 +25,9 @@
static const long Cryptography_HAS_GET_SERVER_TMP_KEY;
static const long Cryptography_HAS_SSL_CTX_SET_CLIENT_CERT_ENGINE;
static const long Cryptography_HAS_SSL_CTX_CLEAR_OPTIONS;
+static const long Cryptography_HAS_NPN_NEGOTIATED;
+
+static const long Cryptography_OPENSSL_NPN_NEGOTIATED;
/* Internally invented symbol to tell us if SNI is supported */
static const long Cryptography_HAS_TLSEXT_HOSTNAME;
@@ -435,6 +438,7 @@
long SSL_CTX_sess_misses(SSL_CTX *);
long SSL_CTX_sess_timeouts(SSL_CTX *);
long SSL_CTX_sess_cache_full(SSL_CTX *);
+
"""
CUSTOMIZATIONS = """
@@ -689,6 +693,14 @@
static const long Cryptography_HAS_SSL_CTX_CLEAR_OPTIONS = 1;
+#ifdef OPENSSL_NPN_NEGOTIATED
+static const long Cryptography_OPENSSL_NPN_NEGOTIATED = OPENSSL_NPN_NEGOTIATED;
+static const long Cryptography_HAS_NPN_NEGOTIATED = 1;
+#else
+static const long Cryptography_OPENSSL_NPN_NEGOTIATED = 0;
+static const long Cryptography_HAS_NPN_NEGOTIATED = 0;
+#endif
+
/* in OpenSSL 1.1.0 the SSL_ST values were renamed to TLS_ST and several were
removed */
#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 || defined(LIBRESSL_VERSION_NUMBER)
diff --git a/lib_pypy/openssl/_stdssl/__init__.py
b/lib_pypy/openssl/_stdssl/__init__.py
--- a/lib_pypy/openssl/_stdssl/__init__.py
+++ b/lib_pypy/openssl/_stdssl/__init__.py
@@ -7,8 +7,9 @@
from _openssl import lib
from openssl._stdssl.certificate import (_test_decode_cert,
_decode_certificate, _certificate_to_der)
-from openssl._std
[pypy-commit] extradoc extradoc: to-do
Author: Armin Rigo Branch: extradoc Changeset: r5747:5ecd9f55400b Date: 2016-11-15 17:56 +0100 http://bitbucket.org/pypy/extradoc/changeset/5ecd9f55400b/ Log:to-do diff --git a/planning/py3.5/milestone-1-progress.rst b/planning/py3.5/milestone-1-progress.rst --- a/planning/py3.5/milestone-1-progress.rst +++ b/planning/py3.5/milestone-1-progress.rst @@ -41,6 +41,9 @@ * PEP 475: Retry system calls failing with EINTR +* ast compiler: clean up POP_EXCEPT: either remove them, or use it to clean up + the "finally: name = None; del name" nonsense at the end of any except block + Milestone 1 (Aug-Sep-Oct 2016) -- ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy cpyext-injection: fix tests for -A
Author: Matti Picus
Branch: cpyext-injection
Changeset: r88389:c5f1e4703974
Date: 2016-11-15 19:30 +0200
http://bitbucket.org/pypy/pypy/changeset/c5f1e4703974/
Log:fix tests for -A
diff --git a/pypy/module/cpyext/injection/test/test_injection.py
b/pypy/module/cpyext/injection/test/test_injection.py
--- a/pypy/module/cpyext/injection/test/test_injection.py
+++ b/pypy/module/cpyext/injection/test/test_injection.py
@@ -1,10 +1,13 @@
from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
from pypy.module.cpyext.pyobject import _has_a_pyobj
from pypy.interpreter.gateway import interp2app
+from pypy.conftest import option
class AppTestTypeObject(AppTestCpythonExtensionBase):
def setup_class(cls):
+if option.runappdirect:
+skip('untranslated only')
def is_there_an_pyobj_version(space, w_obj):
if _has_a_pyobj(space, w_obj):
return space.w_True
diff --git a/pypy/module/cpyext/test/test_cpyext.py
b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -233,7 +233,7 @@
else:
def w_import_module(self, name, init=None, body='', filename=None,
include_dirs=None, PY_SSIZE_T_CLEAN=False):
-from extbuild import get_sys_info_app
+from pypy.tool.cpyext.extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_module(
name, init=init, body=body, filename=filename,
@@ -243,7 +243,7 @@
def w_import_extension(self, modname, functions, prologue="",
include_dirs=None, more_init="", PY_SSIZE_T_CLEAN=False):
-from extbuild import get_sys_info_app
+from pypy.tool.cpyext.extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.import_extension(
modname, functions, prologue=prologue,
@@ -253,14 +253,14 @@
def w_compile_module(self, name,
source_files=None, source_strings=None):
-from extbuild import get_sys_info_app
+from pypy.tool.cpyext.extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.compile_extension_module(name,
source_files=source_files, source_strings=source_strings)
cls.w_compile_module = w_compile_module
def w_load_module(self, mod, name):
-from extbuild import get_sys_info_app
+from pypy.tool.cpyext.extbuild import get_sys_info_app
sys_info = get_sys_info_app(self.udir)
return sys_info.load_module(mod, name)
cls.w_load_module = w_load_module
___
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy cpyext-injection: tweaks for downstream packages
Author: Matti Picus Branch: cpyext-injection Changeset: r88390:7da08ee4b6be Date: 2016-11-15 19:31 +0200 http://bitbucket.org/pypy/pypy/changeset/7da08ee4b6be/ Log:tweaks for downstream packages diff --git a/lib-python/2.7/distutils/sysconfig_pypy.py b/lib-python/2.7/distutils/sysconfig_pypy.py --- a/lib-python/2.7/distutils/sysconfig_pypy.py +++ b/lib-python/2.7/distutils/sysconfig_pypy.py @@ -66,6 +66,7 @@ g['SO'] = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0] g['LIBDIR'] = os.path.join(sys.prefix, 'lib') g['CC'] = "gcc -pthread" # -pthread might not be valid on OS/X, check +g['OPT'] = "" global _config_vars _config_vars = g diff --git a/pypy/module/cpyext/include/pyport.h b/pypy/module/cpyext/include/pyport.h --- a/pypy/module/cpyext/include/pyport.h +++ b/pypy/module/cpyext/include/pyport.h @@ -39,6 +39,10 @@ #define PY_SIZE_MAX ((size_t)-1) #endif +/* CPython needs this for the c-extension datetime, which is pure python on PyPy + downstream packages assume it is here (Pandas for instance) */ +#include + /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again * without loss of information. Similarly for intptr_t, wrt a signed ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: tweaks for downstream packages
Author: Matti Picus Branch: Changeset: r88391:ae0c7c00553c Date: 2016-11-15 19:33 +0200 http://bitbucket.org/pypy/pypy/changeset/ae0c7c00553c/ Log:tweaks for downstream packages diff --git a/lib-python/2.7/distutils/sysconfig_pypy.py b/lib-python/2.7/distutils/sysconfig_pypy.py --- a/lib-python/2.7/distutils/sysconfig_pypy.py +++ b/lib-python/2.7/distutils/sysconfig_pypy.py @@ -66,6 +66,7 @@ g['SO'] = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0] g['LIBDIR'] = os.path.join(sys.prefix, 'lib') g['CC'] = "gcc -pthread" # -pthread might not be valid on OS/X, check +g['OPT'] = "" global _config_vars _config_vars = g diff --git a/pypy/module/cpyext/include/pyport.h b/pypy/module/cpyext/include/pyport.h --- a/pypy/module/cpyext/include/pyport.h +++ b/pypy/module/cpyext/include/pyport.h @@ -39,6 +39,10 @@ #define PY_SIZE_MAX ((size_t)-1) #endif +/* CPython needs this for the c-extension datetime, which is pure python on PyPy + downstream packages assume it is here (Pandas for instance) */ +#include + /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again * without loss of information. Similarly for intptr_t, wrt a signed ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: document the get_config_vars differences
Author: Matti Picus Branch: Changeset: r88392:f3538b9e04af Date: 2016-11-15 19:41 +0200 http://bitbucket.org/pypy/pypy/changeset/f3538b9e04af/ Log:document the get_config_vars differences diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst --- a/pypy/doc/cpython_differences.rst +++ b/pypy/doc/cpython_differences.rst @@ -473,6 +473,10 @@ time and the standard deviation, instead of the minimum, since the minimum is often misleading. +* The ``get_config_vars`` method of ``sysconfig`` and ``distutils.sysconfig`` + are not complete. On POSIX platforms, CPython fishes configuration variables + from the Makefile used to build the interpreter. PyPy should bake the values + in during compilation, but does not do that yet. .. _`is ignored in PyPy`: http://bugs.python.org/issue14621 .. _`little point`: http://events.ccc.de/congress/2012/Fahrplan/events/5152.en.html ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.5-refactor-sys_exc_info: (arigo, cfbolz, richard around):
Author: Carl Friedrich Bolz Branch: py3.5-refactor-sys_exc_info Changeset: r88393:195ff4d7c074 Date: 2016-11-15 18:23 + http://bitbucket.org/pypy/pypy/changeset/195ff4d7c074/ Log:(arigo, cfbolz, richard around): in progress: start a refactoring to store sys_exc_info on the ec, instead of having last_exception on each frame. this makes it more like CPython and should make it possible to not force every frame when an exception is raised. diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py --- a/pypy/interpreter/error.py +++ b/pypy/interpreter/error.py @@ -333,13 +333,12 @@ tb = tb.next self._application_traceback = tb -def record_context(self, space, frame): -"""Record a __context__ for this exception if one exists, -searching from the current frame. +def record_context(self, space, ec): +"""Record a __context__ for this exception if one exists. """ if self._context_recorded: return -last = frame._exc_info_unroll(space) +last = ec.sys_exc_info() try: if last is not None: self.chain_exceptions(space, last) diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py --- a/pypy/interpreter/executioncontext.py +++ b/pypy/interpreter/executioncontext.py @@ -28,6 +28,10 @@ def __init__(self, space): self.space = space self.topframeref = jit.vref_None +# this is exposed to app-level as 'sys.exc_info()'. At any point in +# time it is the exception caught by the topmost 'except ... as e:' +# app-level block. +self.sys_exc_operror = None self.w_tracefunc = None self.is_tracing = 0 self.compiler = space.createcompiler() @@ -230,23 +234,10 @@ # NOTE: the result is not the wrapped sys.exc_info() !!! """ -return self.gettopframe()._exc_info_unroll(self.space) +return self.sys_exc_operror def set_sys_exc_info(self, operror): -frame = self.gettopframe_nohidden() -if frame: # else, the exception goes nowhere and is lost -frame.last_exception = operror - -def clear_sys_exc_info(self): -# Find the frame out of which sys_exc_info() would return its result, -# and hack this frame's last_exception to become the cleared -# OperationError (which is different from None!). -frame = self.gettopframe_nohidden() -while frame: -if frame.last_exception is not None: -frame.last_exception = get_cleared_operation_error(self.space) -break -frame = self.getnextframe_nohidden(frame) +self.sys_exc_operror = operror @jit.dont_look_inside def settrace(self, w_func): @@ -356,7 +347,6 @@ event == 'c_exception'): return -last_exception = frame.last_exception if event == 'leaveframe': event = 'return' @@ -372,7 +362,6 @@ raise finally: -frame.last_exception = last_exception self.is_tracing -= 1 def checksignals(self): diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py --- a/pypy/interpreter/pyframe.py +++ b/pypy/interpreter/pyframe.py @@ -66,7 +66,6 @@ f_generator_wref = rweakref.dead_ref # for generators/coroutines f_generator_nowref = None # (only one of the two attrs) last_instr = -1 -last_exception = None f_backref= jit.vref_None escaped = False # see mark_as_escaped() @@ -328,10 +327,6 @@ executioncontext) finally: executioncontext.return_trace(self, w_exitvalue) -# it used to say self.last_exception = None -# this is now done by the code in pypyjit module -# since we don't want to invalidate the virtualizable -# for no good reason got_exception = False finally: executioncontext.leave(self, w_exitvalue, got_exception) @@ -882,33 +877,6 @@ def fdel_f_trace(self, space): self.getorcreatedebug().w_f_trace = None -def fget_f_exc_type(self, space): -if self.last_exception is not None: -f = self.f_backref() -while f is not None and f.last_exception is None: -f = f.f_backref() -if f is not None: -return f.last_exception.w_type -return space.w_None - -def fget_f_exc_value(self, space): -if self.last_exception is not None: -f = self.f_backref() -while f is not None and f.last_exception is None: -f = f.f_backref() -if f is not None: -
[pypy-commit] pypy pytest-2.9.2: copy upstream pytest-2.9.2 and py-1.4.29
Author: Ronan Lamy
Branch: pytest-2.9.2
Changeset: r88394:f054ccfda623
Date: 2016-11-15 01:46 +
http://bitbucket.org/pypy/pypy/changeset/f054ccfda623/
Log:copy upstream pytest-2.9.2 and py-1.4.29
diff too long, truncating to 2000 out of 12680 lines
diff --git a/_pytest/__init__.py b/_pytest/__init__.py
--- a/_pytest/__init__.py
+++ b/_pytest/__init__.py
@@ -1,2 +1,2 @@
#
-__version__ = '2.5.2'
+__version__ = '2.9.2'
diff --git a/_pytest/_argcomplete.py b/_pytest/_argcomplete.py
--- a/_pytest/_argcomplete.py
+++ b/_pytest/_argcomplete.py
@@ -88,9 +88,6 @@
return completion
if os.environ.get('_ARGCOMPLETE'):
-# argcomplete 0.5.6 is not compatible with python 2.5.6: print/with/format
-if sys.version_info[:2] < (2, 6):
-sys.exit(1)
try:
import argcomplete.completers
except ImportError:
diff --git a/_pytest/assertion/__init__.py b/_pytest/assertion/__init__.py
--- a/_pytest/assertion/__init__.py
+++ b/_pytest/assertion/__init__.py
@@ -2,24 +2,37 @@
support for presenting detailed information in failing assertions.
"""
import py
+import os
import sys
from _pytest.monkeypatch import monkeypatch
from _pytest.assertion import util
+
def pytest_addoption(parser):
group = parser.getgroup("debugconfig")
-group.addoption('--assert', action="store", dest="assertmode",
+group.addoption('--assert',
+action="store",
+dest="assertmode",
choices=("rewrite", "reinterp", "plain",),
-default="rewrite", metavar="MODE",
-help="""control assertion debugging tools.
-'plain' performs no assertion debugging.
-'reinterp' reinterprets assert statements after they failed to provide
assertion expression information.
-'rewrite' (the default) rewrites assert statements in test modules on import
-to provide assert expression information. """)
-group.addoption('--no-assert', action="store_true", default=False,
-dest="noassert", help="DEPRECATED equivalent to --assert=plain")
-group.addoption('--nomagic', '--no-magic', action="store_true",
-default=False, help="DEPRECATED equivalent to --assert=plain")
+default="rewrite",
+metavar="MODE",
+help="""control assertion debugging tools. 'plain'
+performs no assertion debugging. 'reinterp'
+reinterprets assert statements after they failed
+to provide assertion expression information.
+'rewrite' (the default) rewrites assert
+statements in test modules on import to
+provide assert expression information. """)
+group.addoption('--no-assert',
+action="store_true",
+default=False,
+dest="noassert",
+help="DEPRECATED equivalent to --assert=plain")
+group.addoption('--nomagic', '--no-magic',
+action="store_true",
+default=False,
+help="DEPRECATED equivalent to --assert=plain")
+
class AssertionState:
"""State for the assertion plugin."""
@@ -28,6 +41,7 @@
self.mode = mode
self.trace = config.trace.root.get("assertion")
+
def pytest_configure(config):
mode = config.getvalue("assertmode")
if config.getvalue("noassert") or config.getvalue("nomagic"):
@@ -41,7 +55,7 @@
# Both Jython and CPython 2.6.0 have AST bugs that make the
# assertion rewriting hook malfunction.
if (sys.platform.startswith('java') or
-sys.version_info[:3] == (2, 6, 0)):
+sys.version_info[:3] == (2, 6, 0)):
mode = "reinterp"
if mode != "plain":
_load_modules(mode)
@@ -57,11 +71,12 @@
config._assertstate = AssertionState(config, mode)
config._assertstate.hook = hook
config._assertstate.trace("configured with mode set to %r" % (mode,))
+def undo():
+hook = config._assertstate.hook
+if hook is not None and hook in sys.meta_path:
+sys.meta_path.remove(hook)
+config.add_cleanup(undo)
-def pytest_unconfigure(config):
-hook = config._assertstate.hook
-if hook is not None:
-sys.meta_path.remove(hook)
def pytest_collection(session):
# this hook is only called when test modules are collected
@@ -71,36 +86,66 @@
if hook is not None:
hook.set_session(session)
+
+def _running_on_ci():
+"""Check if we're currently running on a CI system."""
+env_vars = ['CI', 'BUILD_NUMBER']
+return any(var in os.environ for var in env_vars)
+
+
def pytest_runtest_setup(item):
+"""Setup the pytest_assertrepr_compare hook
+
+The newinterpret and rewrite modules will use util._reprcompare if
+it exists to use custom reporting via the
+
[pypy-commit] pypy pytest-2.9.2: Add missing _pytest files
Author: Ronan Lamy
Branch: pytest-2.9.2
Changeset: r88397:abcd2a32778c
Date: 2016-11-15 19:44 +
http://bitbucket.org/pypy/pypy/changeset/abcd2a32778c/
Log:Add missing _pytest files
diff too long, truncating to 2000 out of 2510 lines
diff --git a/_pytest/_code/__init__.py b/_pytest/_code/__init__.py
new file mode 100644
--- /dev/null
+++ b/_pytest/_code/__init__.py
@@ -0,0 +1,12 @@
+""" python inspection/code generation API """
+from .code import Code # noqa
+from .code import ExceptionInfo # noqa
+from .code import Frame # noqa
+from .code import Traceback # noqa
+from .code import getrawcode # noqa
+from .code import patch_builtins # noqa
+from .code import unpatch_builtins # noqa
+from .source import Source # noqa
+from .source import compile_ as compile # noqa
+from .source import getfslineno # noqa
+
diff --git a/_pytest/_code/_py2traceback.py b/_pytest/_code/_py2traceback.py
new file mode 100644
--- /dev/null
+++ b/_pytest/_code/_py2traceback.py
@@ -0,0 +1,81 @@
+# copied from python-2.7.3's traceback.py
+# CHANGES:
+# - some_str is replaced, trying to create unicode strings
+#
+import types
+
+def format_exception_only(etype, value):
+"""Format the exception part of a traceback.
+
+The arguments are the exception type and value such as given by
+sys.last_type and sys.last_value. The return value is a list of
+strings, each ending in a newline.
+
+Normally, the list contains a single string; however, for
+SyntaxError exceptions, it contains several lines that (when
+printed) display detailed information about where the syntax
+error occurred.
+
+The message indicating which exception occurred is always the last
+string in the list.
+
+"""
+
+# An instance should not have a meaningful value parameter, but
+# sometimes does, particularly for string exceptions, such as
+# >>> raise string1, string2 # deprecated
+#
+# Clear these out first because issubtype(string1, SyntaxError)
+# would throw another exception and mask the original problem.
+if (isinstance(etype, BaseException) or
+isinstance(etype, types.InstanceType) or
+etype is None or type(etype) is str):
+return [_format_final_exc_line(etype, value)]
+
+stype = etype.__name__
+
+if not issubclass(etype, SyntaxError):
+return [_format_final_exc_line(stype, value)]
+
+# It was a syntax error; show exactly where the problem was found.
+lines = []
+try:
+msg, (filename, lineno, offset, badline) = value.args
+except Exception:
+pass
+else:
+filename = filename or ""
+lines.append(' File "%s", line %d\n' % (filename, lineno))
+if badline is not None:
+if isinstance(badline, bytes): # python 2 only
+badline = badline.decode('utf-8', 'replace')
+lines.append(u'%s\n' % badline.strip())
+if offset is not None:
+caretspace = badline.rstrip('\n')[:offset].lstrip()
+# non-space whitespace (likes tabs) must be kept for alignment
+caretspace = ((c.isspace() and c or ' ') for c in caretspace)
+# only three spaces to account for offset1 == pos 0
+lines.append(' %s^\n' % ''.join(caretspace))
+value = msg
+
+lines.append(_format_final_exc_line(stype, value))
+return lines
+
+def _format_final_exc_line(etype, value):
+"""Return a list of a single line -- normal case for
format_exception_only"""
+valuestr = _some_str(value)
+if value is None or not valuestr:
+line = "%s\n" % etype
+else:
+line = "%s: %s\n" % (etype, valuestr)
+return line
+
+def _some_str(value):
+try:
+return unicode(value)
+except Exception:
+try:
+return str(value)
+except Exception:
+pass
+return '' % type(value).__name__
diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py
new file mode 100644
--- /dev/null
+++ b/_pytest/_code/code.py
@@ -0,0 +1,805 @@
+import sys
+from inspect import CO_VARARGS, CO_VARKEYWORDS
+
+import py
+
+builtin_repr = repr
+
+reprlib = py.builtin._tryimport('repr', 'reprlib')
+
+if sys.version_info[0] >= 3:
+from traceback import format_exception_only
+else:
+from ._py2traceback import format_exception_only
+
+class Code(object):
+""" wrapper around Python code objects """
+def __init__(self, rawcode):
+if not hasattr(rawcode, "co_filename"):
+rawcode = getrawcode(rawcode)
+try:
+self.filename = rawcode.co_filename
+self.firstlineno = rawcode.co_firstlineno - 1
+self.name = rawcode.co_name
+except AttributeError:
+raise TypeError("not a code object: %r" %(rawcode,))
+self.raw = rawcode
+
+def __eq__(self, other):
+return self.raw == other.raw
+
+def __ne__(self, other):
+return not self == other
+
+
[pypy-commit] pypy default: write at yet another place this F.A.Q.
Author: Armin Rigo Branch: Changeset: r88398:416d9a87c548 Date: 2016-11-15 23:07 +0100 http://bitbucket.org/pypy/pypy/changeset/416d9a87c548/ Log:write at yet another place this F.A.Q. diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst --- a/pypy/doc/faq.rst +++ b/pypy/doc/faq.rst @@ -90,6 +90,10 @@ Do CPython Extension modules work with PyPy? +**First note that some Linux distributions (e.g. Ubuntu, Debian) split +PyPy into several packages. If you installed a package called "pypy", +then you may also need to install "pypy-dev" for the following to work.** + We have experimental support for CPython extension modules, so they run with minor changes. This has been a part of PyPy since the 1.4 release, but support is still in beta phase. CPython ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pytest-2.9.2: Don't interpret exitcode 5 (no tests were run) as a failure
Author: Ronan Lamy
Branch: pytest-2.9.2
Changeset: r88399:679a4be18d09
Date: 2016-11-15 23:26 +
http://bitbucket.org/pypy/pypy/changeset/679a4be18d09/
Log:Don't interpret exitcode 5 (no tests were run) as a failure
diff --git a/testrunner/runner.py b/testrunner/runner.py
--- a/testrunner/runner.py
+++ b/testrunner/runner.py
@@ -127,9 +127,9 @@
runfunc = dry_run
else:
runfunc = run
-
+
exitcode = runfunc(args, cwd, out, timeout=timeout)
-
+
return exitcode
def should_report_failure(logdata):
@@ -147,7 +147,7 @@
def interpret_exitcode(exitcode, test, logdata=""):
extralog = ""
-if exitcode:
+if exitcode not in (0, 5):
failure = True
if exitcode != 1 or should_report_failure(logdata):
if exitcode > 0:
@@ -268,14 +268,14 @@
out.write("++ %s starting %s [%d started in total]\n" % (now,
res[1],
started))
continue
-
+
testname, somefailed, logdata, output = res[1:]
done += 1
failure = failure or somefailed
heading = "__ %s [%d done in total, somefailed=%s] " % (
testname, done, somefailed)
-
+
out.write(heading + (79-len(heading))*'_'+'\n')
out.write(output)
@@ -299,7 +299,7 @@
parallel_runs = 1
timeout = None
cherrypick = None
-
+
def __init__(self, root):
self.root = root
self.self = self
@@ -372,7 +372,7 @@
parser.add_option("--timeout", dest="timeout", default=None,
type="int",
help="timeout in secs for test processes")
-
+
opts, args = parser.parse_args(args)
if opts.logfile is None:
@@ -417,7 +417,7 @@
if run_param.dry_run:
print >>out, '\n'.join([str((k, getattr(run_param, k))) \
for k in dir(run_param) if k[:2] != '__'])
-
+
res = execute_tests(run_param, testdirs, logfile, out)
if res:
___
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pytest-2.9.2: update testrunner tests
Author: Ronan Lamy
Branch: pytest-2.9.2
Changeset: r88401:ef20239bae31
Date: 2016-11-15 23:53 +
http://bitbucket.org/pypy/pypy/changeset/ef20239bae31/
Log:update testrunner tests
diff --git a/testrunner/test/conftest.py b/testrunner/test/conftest.py
--- a/testrunner/test/conftest.py
+++ b/testrunner/test/conftest.py
@@ -2,7 +2,6 @@
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item):
-report = yield
+report = (yield).result
if 'out' in item.funcargs:
report.sections.append(('out', item.funcargs['out'].read()))
-return report
diff --git a/testrunner/test/test_runner.py b/testrunner/test/test_runner.py
--- a/testrunner/test/test_runner.py
+++ b/testrunner/test/test_runner.py
@@ -84,14 +84,14 @@
def test_timeout_syscall(self, out):
res = runner.run([sys.executable, "-c", "import socket; s=s =
socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.bind(('', 0));
s.recv(1000)"], '.', out, timeout=3)
-assert res == -999
+assert res == -999
def test_timeout_success(self, out):
res = runner.run([sys.executable, "-c", "print 42"], '.',
out, timeout=2)
assert res == 0
out = out.read()
-assert out == "42\n"
+assert out == "42\n"
class TestExecuteTest(object):
@@ -100,7 +100,7 @@
cls.real_run = (runner.run,)
cls.called = []
cls.exitcode = [0]
-
+
def fake_run(args, cwd, out, timeout):
cls.called = (args, cwd, out, timeout)
return cls.exitcode[0]
@@ -123,7 +123,7 @@
'test_one']
-assert self.called == (expected, '/wd', 'out', 'secs')
+assert self.called == (expected, '/wd', 'out', 'secs')
assert res == 0
def test_explicit_win32(self):
@@ -141,7 +141,7 @@
#'--junitxml=LOGFILE.junit',
'test_one']
assert self.called[0] == expected
-assert self.called == (expected, '/wd', 'out', 'secs')
+assert self.called == (expected, '/wd', 'out', 'secs')
assert res == 0
def test_error(self):
@@ -193,14 +193,14 @@
cls.real_invoke_in_thread = (runner.invoke_in_thread,)
if not cls.with_thread:
runner.invoke_in_thread = lambda func, args: func(*args)
-
+
cls.udir = py.path.local.make_numbered_dir(prefix='usession-runner-',
keep=3)
cls.manydir = cls.udir.join('many').ensure(dir=1)
cls.udir.join("conftest.py").write("pytest_plugins = 'resultlog'\n")
-def fill_test_dir(test_dir, fromdir='normal'):
+def fill_test_dir(test_dir, fromdir='normal'):
for p in py.path.local(__file__).dirpath(
'examples', fromdir).listdir("*.py"):
p.copy(test_dir.join('test_'+p.basename))
@@ -210,7 +210,7 @@
cls.one_test_dir = cls.manydir.join('one')
fill_test_dir(test_normal_dir0)
-
+
test_normal_dir1 = cls.manydir.join('two',
'test_normal1').ensure(dir=1)
test_normal_dir2 = cls.manydir.join('two', 'pkg',
@@ -235,8 +235,8 @@
run_param = runner.RunParam(self.one_test_dir)
run_param.test_driver = test_driver
-run_param.parallel_runs = 3
-
+run_param.parallel_runs = 3
+
res = runner.execute_tests(run_param, ['test_normal'], log, out)
assert res
@@ -248,10 +248,10 @@
log = log.getvalue()
assert '\r\n' not in log
-assert '\n' in log
+assert '\n' in log
log_lines = log.splitlines()
-assert ". test_normal/test_example.py::test_one" in log_lines
+assert ". test_example.py::test_one" in log_lines
nfailures = 0
noutcomes = 0
for line in log_lines:
@@ -273,7 +273,7 @@
run_param.test_driver = test_driver
run_param.parallel_runs = 3
run_param.dry_run = True
-
+
res = runner.execute_tests(run_param, ['test_normal'], log, out)
assert not res
@@ -282,11 +282,11 @@
out_lines = out.getvalue().splitlines()
-assert len(out_lines) == 5
+assert len(out_lines) == 7
-assert out_lines[2].startswith("++ starting")
-assert out_lines[4].startswith("run [")
-for line in out_lines[2:]:
+assert 'starting' in out_lines[4]
+assert out_lines[6].startswith("run [")
+for line in out_lines[4:]:
assert "test_normal" in line
def test_many_dirs(self):
@@ -307,7 +307,7 @@
testdirs = []
run_param.collect_testdirs(testdirs)
alltestdirs = testdirs[:]
-
+
res = runner.execute_tests(run_param, testdirs, log, out)
assert res
@@ -366,7 +366,7 @@
def test_run_bad_get_test_driver(self):
test
[pypy-commit] pypy pytest-2.9.2: Don't use deprecated __multicall__
Author: Ronan Lamy Branch: pytest-2.9.2 Changeset: r88400:2375f918f240 Date: 2016-11-15 23:38 + http://bitbucket.org/pypy/pypy/changeset/2375f918f240/ Log:Don't use deprecated __multicall__ diff --git a/pypy/conftest.py b/pypy/conftest.py --- a/pypy/conftest.py +++ b/pypy/conftest.py @@ -159,7 +159,8 @@ return space -def pytest_runtest_setup(__multicall__, item): [email protected](tryfirst=True) +def pytest_runtest_setup(item): if isinstance(item, py.test.collect.Function): appclass = item.getparent(py.test.Class) if appclass is not None: @@ -172,8 +173,6 @@ appclass.obj.space = LazyObjSpaceGetter() appclass.obj.runappdirect = option.runappdirect -__multicall__.execute() - def pytest_ignore_collect(path): return path.check(link=1) diff --git a/rpython/conftest.py b/rpython/conftest.py --- a/rpython/conftest.py +++ b/rpython/conftest.py @@ -45,16 +45,6 @@ help="show the dependencies that have been constructed from a trace") -def pytest_pycollect_makeitem(__multicall__,collector, name, obj): -res = __multicall__.execute() -# work around pytest issue 251 -import inspect -if res is None and inspect.isclass(obj) and \ -collector.classnamefilter(name): -return py.test.collect.Class(name, parent=collector) -return res - - def pytest_addhooks(pluginmanager): pluginmanager.register(LeakFinder()) @@ -63,21 +53,21 @@ So far, only used by the function lltype.malloc(flavor='raw'). """ -def pytest_runtest_setup(self, __multicall__, item): -__multicall__.execute() [email protected](trylast=True) +def pytest_runtest_setup(self, item): if not isinstance(item, py.test.collect.Function): return if not getattr(item.obj, 'dont_track_allocations', False): leakfinder.start_tracking_allocations() -def pytest_runtest_call(self, __multicall__, item): -__multicall__.execute() [email protected](trylast=True) +def pytest_runtest_call(self, item): if not isinstance(item, py.test.collect.Function): return item._success = True -def pytest_runtest_teardown(self, __multicall__, item): -__multicall__.execute() [email protected](trylast=True) +def pytest_runtest_teardown(self, item): if not isinstance(item, py.test.collect.Function): return if (not getattr(item.obj, 'dont_track_allocations', False) diff --git a/testrunner/test/conftest.py b/testrunner/test/conftest.py --- a/testrunner/test/conftest.py +++ b/testrunner/test/conftest.py @@ -1,6 +1,8 @@ +import pytest -def pytest_runtest_makereport(__multicall__, item): -report = __multicall__.execute() [email protected](hookwrapper=True) +def pytest_runtest_makereport(item): +report = yield if 'out' in item.funcargs: report.sections.append(('out', item.funcargs['out'].read())) return report ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pytest-2.9.2: Fix lib-python conftest.py
Author: Ronan Lamy Branch: pytest-2.9.2 Changeset: r88402:3d4564d1d24c Date: 2016-11-16 03:10 + http://bitbucket.org/pypy/pypy/changeset/3d4564d1d24c/ Log:Fix lib-python conftest.py diff --git a/lib-python/conftest.py b/lib-python/conftest.py --- a/lib-python/conftest.py +++ b/lib-python/conftest.py @@ -5,9 +5,10 @@ """ import py +import pytest import sys +import re import pypy -import re from pypy.interpreter.gateway import ApplevelClass from pypy.interpreter.error import OperationError from pypy.interpreter.module import Module as PyPyModule @@ -517,16 +518,16 @@ for x in testmap: cache[x.basename] = x -def pytest_collect_file(path, parent, __multicall__): -# don't collect files except through this hook -# implemented by clearing the list of to-be-called -# remaining hook methods -__multicall__.methods[:] = [] -regrtest = parent.config._basename2spec.get(path.basename, None) -if regrtest is None: -return -if path.dirpath() != testdir: -return +def pytest_ignore_collect(path, config): +if path.isfile(): +regrtest = config._basename2spec.get(path.basename, None) +if regrtest is None or path.dirpath() != testdir: +return True + [email protected](tryfirst=True) +def pytest_pycollect_makemodule(path, parent): +config = parent.config +regrtest = config._basename2spec[path.basename] return RunFileExternal(path.basename, parent=parent, regrtest=regrtest) class RunFileExternal(py.test.collect.File): ___ pypy-commit mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-commit
