Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3.5 Changeset: r95327:10b8fc6af4a3 Date: 2018-11-16 20:02 +0000 http://bitbucket.org/pypy/pypy/changeset/10b8fc6af4a3/
Log: hg merge default diff --git a/extra_tests/__init__.py b/extra_tests/__init__.py new file mode 100644 diff --git a/pypy/module/test_lib_pypy/cffi_tests/__init__.py b/extra_tests/cffi_tests/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/__init__.py rename to extra_tests/cffi_tests/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/__init__.py b/extra_tests/cffi_tests/cffi0/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/__init__.py rename to extra_tests/cffi_tests/cffi0/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/extra_tests/cffi_tests/cffi0/backend_tests.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py rename to extra_tests/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/extra_tests/cffi_tests/cffi0/backend_tests.py @@ -3,7 +3,7 @@ import platform import sys, ctypes from cffi import FFI, CDefError, FFIError, VerificationMissing -from pypy.module.test_lib_pypy.cffi_tests.support import * +from extra_tests.cffi_tests.support import * SIZE_OF_INT = ctypes.sizeof(ctypes.c_int) SIZE_OF_LONG = ctypes.sizeof(ctypes.c_long) diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/callback_in_thread.py b/extra_tests/cffi_tests/cffi0/callback_in_thread.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/callback_in_thread.py rename to extra_tests/cffi_tests/cffi0/callback_in_thread.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_module/setup.py b/extra_tests/cffi_tests/cffi0/snippets/distutils_module/setup.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_module/setup.py rename to extra_tests/cffi_tests/cffi0/snippets/distutils_module/setup.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_module/snip_basic_verify.py b/extra_tests/cffi_tests/cffi0/snippets/distutils_module/snip_basic_verify.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_module/snip_basic_verify.py rename to extra_tests/cffi_tests/cffi0/snippets/distutils_module/snip_basic_verify.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_1/setup.py b/extra_tests/cffi_tests/cffi0/snippets/distutils_package_1/setup.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_1/setup.py rename to extra_tests/cffi_tests/cffi0/snippets/distutils_package_1/setup.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_1/snip_basic_verify1/__init__.py b/extra_tests/cffi_tests/cffi0/snippets/distutils_package_1/snip_basic_verify1/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_1/snip_basic_verify1/__init__.py rename to extra_tests/cffi_tests/cffi0/snippets/distutils_package_1/snip_basic_verify1/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_2/setup.py b/extra_tests/cffi_tests/cffi0/snippets/distutils_package_2/setup.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_2/setup.py rename to extra_tests/cffi_tests/cffi0/snippets/distutils_package_2/setup.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_2/snip_basic_verify2/__init__.py b/extra_tests/cffi_tests/cffi0/snippets/distutils_package_2/snip_basic_verify2/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/distutils_package_2/snip_basic_verify2/__init__.py rename to extra_tests/cffi_tests/cffi0/snippets/distutils_package_2/snip_basic_verify2/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/infrastructure/setup.py b/extra_tests/cffi_tests/cffi0/snippets/infrastructure/setup.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/infrastructure/setup.py rename to extra_tests/cffi_tests/cffi0/snippets/infrastructure/setup.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/infrastructure/snip_infrastructure/__init__.py b/extra_tests/cffi_tests/cffi0/snippets/infrastructure/snip_infrastructure/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/infrastructure/snip_infrastructure/__init__.py rename to extra_tests/cffi_tests/cffi0/snippets/infrastructure/snip_infrastructure/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_module/setup.py b/extra_tests/cffi_tests/cffi0/snippets/setuptools_module/setup.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_module/setup.py rename to extra_tests/cffi_tests/cffi0/snippets/setuptools_module/setup.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_module/snip_setuptools_verify.py b/extra_tests/cffi_tests/cffi0/snippets/setuptools_module/snip_setuptools_verify.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_module/snip_setuptools_verify.py rename to extra_tests/cffi_tests/cffi0/snippets/setuptools_module/snip_setuptools_verify.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_1/setup.py b/extra_tests/cffi_tests/cffi0/snippets/setuptools_package_1/setup.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_1/setup.py rename to extra_tests/cffi_tests/cffi0/snippets/setuptools_package_1/setup.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_1/snip_setuptools_verify1/__init__.py b/extra_tests/cffi_tests/cffi0/snippets/setuptools_package_1/snip_setuptools_verify1/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_1/snip_setuptools_verify1/__init__.py rename to extra_tests/cffi_tests/cffi0/snippets/setuptools_package_1/snip_setuptools_verify1/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_2/setup.py b/extra_tests/cffi_tests/cffi0/snippets/setuptools_package_2/setup.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_2/setup.py rename to extra_tests/cffi_tests/cffi0/snippets/setuptools_package_2/setup.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_2/snip_setuptools_verify2/__init__.py b/extra_tests/cffi_tests/cffi0/snippets/setuptools_package_2/snip_setuptools_verify2/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/snippets/setuptools_package_2/snip_setuptools_verify2/__init__.py rename to extra_tests/cffi_tests/cffi0/snippets/setuptools_package_2/snip_setuptools_verify2/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_cdata.py b/extra_tests/cffi_tests/cffi0/test_cdata.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_cdata.py rename to extra_tests/cffi_tests/cffi0/test_cdata.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ctypes.py b/extra_tests/cffi_tests/cffi0/test_ctypes.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ctypes.py rename to extra_tests/cffi_tests/cffi0/test_ctypes.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ctypes.py +++ b/extra_tests/cffi_tests/cffi0/test_ctypes.py @@ -1,6 +1,6 @@ # Generated by pypy/tool/import_cffi.py import py, sys -from pypy.module.test_lib_pypy.cffi_tests.cffi0 import backend_tests +from extra_tests.cffi_tests.cffi0 import backend_tests from cffi.backend_ctypes import CTypesBackend diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ffi_backend.py b/extra_tests/cffi_tests/cffi0/test_ffi_backend.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ffi_backend.py rename to extra_tests/cffi_tests/cffi0/test_ffi_backend.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ffi_backend.py +++ b/extra_tests/cffi_tests/cffi0/test_ffi_backend.py @@ -1,8 +1,8 @@ # Generated by pypy/tool/import_cffi.py import py, sys, platform import pytest -from pypy.module.test_lib_pypy.cffi_tests.cffi0 import backend_tests, test_function, test_ownlib -from pypy.module.test_lib_pypy.cffi_tests.support import u +from extra_tests.cffi_tests.cffi0 import backend_tests, test_function, test_ownlib +from extra_tests.cffi_tests.support import u from cffi import FFI import _cffi_backend diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py b/extra_tests/cffi_tests/cffi0/test_function.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py rename to extra_tests/cffi_tests/cffi0/test_function.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_function.py +++ b/extra_tests/cffi_tests/cffi0/test_function.py @@ -4,8 +4,8 @@ import math, os, sys import ctypes.util from cffi.backend_ctypes import CTypesBackend -from pypy.module.test_lib_pypy.cffi_tests.udir import udir -from pypy.module.test_lib_pypy.cffi_tests.support import FdWriteCapture +from extra_tests.cffi_tests.udir import udir +from extra_tests.cffi_tests.support import FdWriteCapture from .backend_tests import needs_dlopen_none try: diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_model.py b/extra_tests/cffi_tests/cffi0/test_model.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_model.py rename to extra_tests/cffi_tests/cffi0/test_model.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ownlib.py b/extra_tests/cffi_tests/cffi0/test_ownlib.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ownlib.py rename to extra_tests/cffi_tests/cffi0/test_ownlib.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_ownlib.py +++ b/extra_tests/cffi_tests/cffi0/test_ownlib.py @@ -1,9 +1,9 @@ # Generated by pypy/tool/import_cffi.py -import py, sys +import py, sys, os import subprocess, weakref from cffi import FFI from cffi.backend_ctypes import CTypesBackend -from pypy.module.test_lib_pypy.cffi_tests.support import u +from extra_tests.cffi_tests.support import u SOURCE = """\ @@ -115,10 +115,9 @@ def setup_class(cls): cls.module = None - from pypy.module.test_lib_pypy.cffi_tests.udir import udir + from extra_tests.cffi_tests.udir import udir udir.join('testownlib.c').write(SOURCE) if sys.platform == 'win32': - import os # did we already build it? if cls.Backend is CTypesBackend: dll_path = str(udir) + '\\testownlib1.dll' # only ascii for the ctypes backend @@ -149,10 +148,23 @@ os.rename(str(udir) + '\\testownlib.dll', dll_path) cls.module = dll_path else: + encoded = None + if cls.Backend is not CTypesBackend: + try: + unicode_name = u+'testownlibcaf\xe9' + encoded = unicode_name.encode(sys.getfilesystemencoding()) + if sys.version_info >= (3,): + encoded = str(unicode_name) + except UnicodeEncodeError: + pass + if encoded is None: + unicode_name = u+'testownlib' + encoded = str(unicode_name) subprocess.check_call( - 'cc testownlib.c -shared -fPIC -o testownlib.so', + "cc testownlib.c -shared -fPIC -o '%s.so'" % (encoded,), cwd=str(udir), shell=True) - cls.module = str(udir.join('testownlib.so')) + cls.module = os.path.join(str(udir), unicode_name + (u+'.so')) + print(repr(cls.module)) def test_getting_errno(self): if self.module is None: diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py b/extra_tests/cffi_tests/cffi0/test_parsing.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_parsing.py rename to extra_tests/cffi_tests/cffi0/test_parsing.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_platform.py b/extra_tests/cffi_tests/cffi0/test_platform.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_platform.py rename to extra_tests/cffi_tests/cffi0/test_platform.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_unicode_literals.py b/extra_tests/cffi_tests/cffi0/test_unicode_literals.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_unicode_literals.py rename to extra_tests/cffi_tests/cffi0/test_unicode_literals.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py b/extra_tests/cffi_tests/cffi0/test_verify.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py rename to extra_tests/cffi_tests/cffi0/test_verify.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py +++ b/extra_tests/cffi_tests/cffi0/test_verify.py @@ -2,7 +2,7 @@ import py, re import sys, os, math, weakref from cffi import FFI, VerificationError, VerificationMissing, model, FFIError -from pypy.module.test_lib_pypy.cffi_tests.support import * +from extra_tests.cffi_tests.support import * lib_m = ['m'] @@ -1408,7 +1408,7 @@ def test_tmpdir(): import tempfile, os - from pypy.module.test_lib_pypy.cffi_tests.udir import udir + from extra_tests.cffi_tests.udir import udir tmpdir = tempfile.mkdtemp(dir=str(udir)) ffi = FFI() ffi.cdef("int foo(int);") @@ -1418,7 +1418,7 @@ def test_relative_to(): import tempfile, os - from pypy.module.test_lib_pypy.cffi_tests.udir import udir + from extra_tests.cffi_tests.udir import udir tmpdir = tempfile.mkdtemp(dir=str(udir)) ffi = FFI() ffi.cdef("int foo(int);") diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify2.py b/extra_tests/cffi_tests/cffi0/test_verify2.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify2.py rename to extra_tests/cffi_tests/cffi0/test_verify2.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py b/extra_tests/cffi_tests/cffi0/test_version.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py rename to extra_tests/cffi_tests/cffi0/test_version.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_vgen.py b/extra_tests/cffi_tests/cffi0/test_vgen.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_vgen.py rename to extra_tests/cffi_tests/cffi0/test_vgen.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_vgen2.py b/extra_tests/cffi_tests/cffi0/test_vgen2.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_vgen2.py rename to extra_tests/cffi_tests/cffi0/test_vgen2.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zdistutils.py b/extra_tests/cffi_tests/cffi0/test_zdistutils.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zdistutils.py rename to extra_tests/cffi_tests/cffi0/test_zdistutils.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zdistutils.py +++ b/extra_tests/cffi_tests/cffi0/test_zdistutils.py @@ -4,7 +4,7 @@ from cffi import FFI, FFIError from cffi.verifier import Verifier, _locate_engine_class, _get_so_suffixes from cffi.ffiplatform import maybe_relative_path -from pypy.module.test_lib_pypy.cffi_tests.udir import udir +from extra_tests.cffi_tests.udir import udir class DistUtilsTest(object): diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py b/extra_tests/cffi_tests/cffi0/test_zintegration.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py rename to extra_tests/cffi_tests/cffi0/test_zintegration.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_zintegration.py +++ b/extra_tests/cffi_tests/cffi0/test_zintegration.py @@ -1,7 +1,7 @@ # Generated by pypy/tool/import_cffi.py import py, os, sys, shutil import subprocess -from pypy.module.test_lib_pypy.cffi_tests.udir import udir +from extra_tests.cffi_tests.udir import udir if sys.platform == 'win32': py.test.skip('snippets do not run on win32') diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/__init__.py b/extra_tests/cffi_tests/cffi1/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/__init__.py rename to extra_tests/cffi_tests/cffi1/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_cffi_binary.py b/extra_tests/cffi_tests/cffi1/test_cffi_binary.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_cffi_binary.py rename to extra_tests/cffi_tests/cffi1/test_cffi_binary.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py b/extra_tests/cffi_tests/cffi1/test_commontypes.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_commontypes.py rename to extra_tests/cffi_tests/cffi1/test_commontypes.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_dlopen.py b/extra_tests/cffi_tests/cffi1/test_dlopen.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_dlopen.py rename to extra_tests/cffi_tests/cffi1/test_dlopen.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_dlopen.py +++ b/extra_tests/cffi_tests/cffi1/test_dlopen.py @@ -2,7 +2,7 @@ import py from cffi import FFI, VerificationError, CDefError from cffi.recompiler import make_py_source -from pypy.module.test_lib_pypy.cffi_tests.udir import udir +from extra_tests.cffi_tests.udir import udir def test_simple(): diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_dlopen_unicode_literals.py b/extra_tests/cffi_tests/cffi1/test_dlopen_unicode_literals.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_dlopen_unicode_literals.py rename to extra_tests/cffi_tests/cffi1/test_dlopen_unicode_literals.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py b/extra_tests/cffi_tests/cffi1/test_ffi_obj.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_ffi_obj.py rename to extra_tests/cffi_tests/cffi1/test_ffi_obj.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_new_ffi_1.py b/extra_tests/cffi_tests/cffi1/test_new_ffi_1.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_new_ffi_1.py rename to extra_tests/cffi_tests/cffi1/test_new_ffi_1.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_new_ffi_1.py +++ b/extra_tests/cffi_tests/cffi1/test_new_ffi_1.py @@ -3,8 +3,8 @@ import platform, imp import sys, os, ctypes import cffi -from pypy.module.test_lib_pypy.cffi_tests.udir import udir -from pypy.module.test_lib_pypy.cffi_tests.support import * +from extra_tests.cffi_tests.udir import udir +from extra_tests.cffi_tests.support import * from cffi.recompiler import recompile from cffi.cffi_opcode import PRIMITIVE_TO_INDEX diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_parse_c_type.py b/extra_tests/cffi_tests/cffi1/test_parse_c_type.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_parse_c_type.py rename to extra_tests/cffi_tests/cffi1/test_parse_c_type.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_re_python.py b/extra_tests/cffi_tests/cffi1/test_re_python.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_re_python.py rename to extra_tests/cffi_tests/cffi1/test_re_python.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_re_python.py +++ b/extra_tests/cffi_tests/cffi1/test_re_python.py @@ -3,8 +3,8 @@ import py from cffi import FFI from cffi import recompiler, ffiplatform, VerificationMissing -from pypy.module.test_lib_pypy.cffi_tests.udir import udir -from pypy.module.test_lib_pypy.cffi_tests.support import u +from extra_tests.cffi_tests.udir import udir +from extra_tests.cffi_tests.support import u def setup_module(mod): @@ -37,13 +37,22 @@ 'globalconst42', 'globalconsthello'] ) outputfilename = ffiplatform.compile(str(tmpdir), ext) + + # test with a non-ascii char + ofn, oext = os.path.splitext(outputfilename) if sys.platform == "win32": - # test with a non-ascii char - outputfn1 = outputfilename - ofn, oext = os.path.splitext(outputfn1) - outputfilename = ofn + (u+'\u03be') + oext - #print(repr(outputfn1) + ' ==> ' + repr(outputfilename)) - os.rename(outputfn1, outputfilename) + unicode_name = ofn + (u+'\u03be') + oext + else: + unicode_name = ofn + (u+'\xe9') + oext + try: + unicode_name.encode(sys.getfilesystemencoding()) + except UnicodeEncodeError: + unicode_name = None + if unicode_name is not None: + print(repr(outputfilename) + ' ==> ' + repr(unicode_name)) + os.rename(outputfilename, unicode_name) + outputfilename = unicode_name + mod.extmod = outputfilename mod.tmpdir = tmpdir # diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_realize_c_type.py b/extra_tests/cffi_tests/cffi1/test_realize_c_type.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_realize_c_type.py rename to extra_tests/cffi_tests/cffi1/test_realize_c_type.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py b/extra_tests/cffi_tests/cffi1/test_recompiler.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py rename to extra_tests/cffi_tests/cffi1/test_recompiler.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py +++ b/extra_tests/cffi_tests/cffi1/test_recompiler.py @@ -3,9 +3,9 @@ import sys, os, py from cffi import FFI, VerificationError, FFIError, CDefError from cffi import recompiler -from pypy.module.test_lib_pypy.cffi_tests.udir import udir -from pypy.module.test_lib_pypy.cffi_tests.support import u, long -from pypy.module.test_lib_pypy.cffi_tests.support import FdWriteCapture, StdErrCapture +from extra_tests.cffi_tests.udir import udir +from extra_tests.cffi_tests.support import u, long +from extra_tests.cffi_tests.support import FdWriteCapture, StdErrCapture try: import importlib diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_unicode_literals.py b/extra_tests/cffi_tests/cffi1/test_unicode_literals.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_unicode_literals.py rename to extra_tests/cffi_tests/cffi1/test_unicode_literals.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py b/extra_tests/cffi_tests/cffi1/test_verify1.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py rename to extra_tests/cffi_tests/cffi1/test_verify1.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py +++ b/extra_tests/cffi_tests/cffi1/test_verify1.py @@ -3,7 +3,7 @@ from cffi import FFI, FFIError, VerificationError, VerificationMissing, model from cffi import CDefError from cffi import recompiler -from pypy.module.test_lib_pypy.cffi_tests.support import * +from extra_tests.cffi_tests.support import * import _cffi_backend lib_m = ['m'] @@ -1377,7 +1377,7 @@ def test_tmpdir(): import tempfile, os - from pypy.module.test_lib_pypy.cffi_tests.udir import udir + from extra_tests.cffi_tests.udir import udir tmpdir = tempfile.mkdtemp(dir=str(udir)) ffi = FFI() ffi.cdef("int foo(int);") @@ -1388,7 +1388,7 @@ def test_relative_to(): py.test.skip("not available") import tempfile, os - from pypy.module.test_lib_pypy.cffi_tests.udir import udir + from extra_tests.cffi_tests.udir import udir tmpdir = tempfile.mkdtemp(dir=str(udir)) ffi = FFI() ffi.cdef("int foo(int);") @@ -2234,7 +2234,7 @@ def test_windows_dllimport_data(): if sys.platform != 'win32': py.test.skip("Windows only") - from pypy.module.test_lib_pypy.cffi_tests.udir import udir + from extra_tests.cffi_tests.udir import udir tmpfile = udir.join('dllimport_data.c') tmpfile.write('int my_value = 42;\n') ffi = FFI() diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_zdist.py b/extra_tests/cffi_tests/cffi1/test_zdist.py rename from pypy/module/test_lib_pypy/cffi_tests/cffi1/test_zdist.py rename to extra_tests/cffi_tests/cffi1/test_zdist.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_zdist.py +++ b/extra_tests/cffi_tests/cffi1/test_zdist.py @@ -2,7 +2,7 @@ import sys, os, py import subprocess import cffi -from pypy.module.test_lib_pypy.cffi_tests.udir import udir +from extra_tests.cffi_tests.udir import udir from shutil import rmtree from tempfile import mkdtemp diff --git a/pypy/module/test_lib_pypy/cffi_tests/conftest.py b/extra_tests/cffi_tests/conftest.py rename from pypy/module/test_lib_pypy/cffi_tests/conftest.py rename to extra_tests/cffi_tests/conftest.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/__init__.py b/extra_tests/cffi_tests/embedding/__init__.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/__init__.py rename to extra_tests/cffi_tests/embedding/__init__.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/add1-test.c b/extra_tests/cffi_tests/embedding/add1-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/add1-test.c rename to extra_tests/cffi_tests/embedding/add1-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/add1.py b/extra_tests/cffi_tests/embedding/add1.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/add1.py rename to extra_tests/cffi_tests/embedding/add1.py --- a/pypy/module/test_lib_pypy/cffi_tests/embedding/add1.py +++ b/extra_tests/cffi_tests/embedding/add1.py @@ -12,7 +12,7 @@ sys.stdout.write("preparing") for i in range(3): sys.stdout.flush() - time.sleep(0.02) + time.sleep(0.2) sys.stdout.write(".") sys.stdout.write("\n") diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/add2-test.c b/extra_tests/cffi_tests/embedding/add2-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/add2-test.c rename to extra_tests/cffi_tests/embedding/add2-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/add2.py b/extra_tests/cffi_tests/embedding/add2.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/add2.py rename to extra_tests/cffi_tests/embedding/add2.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/add3.py b/extra_tests/cffi_tests/embedding/add3.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/add3.py rename to extra_tests/cffi_tests/embedding/add3.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/add_recursive-test.c b/extra_tests/cffi_tests/embedding/add_recursive-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/add_recursive-test.c rename to extra_tests/cffi_tests/embedding/add_recursive-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/add_recursive.py b/extra_tests/cffi_tests/embedding/add_recursive.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/add_recursive.py rename to extra_tests/cffi_tests/embedding/add_recursive.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/empty.py b/extra_tests/cffi_tests/embedding/empty.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/empty.py rename to extra_tests/cffi_tests/embedding/empty.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/initerror.py b/extra_tests/cffi_tests/embedding/initerror.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/initerror.py rename to extra_tests/cffi_tests/embedding/initerror.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/perf-test.c b/extra_tests/cffi_tests/embedding/perf-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/perf-test.c rename to extra_tests/cffi_tests/embedding/perf-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/perf.py b/extra_tests/cffi_tests/embedding/perf.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/perf.py rename to extra_tests/cffi_tests/embedding/perf.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_basic.py b/extra_tests/cffi_tests/embedding/test_basic.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/test_basic.py rename to extra_tests/cffi_tests/embedding/test_basic.py --- a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_basic.py +++ b/extra_tests/cffi_tests/embedding/test_basic.py @@ -2,7 +2,7 @@ import py import sys, os, re import shutil, subprocess, time -from pypy.module.test_lib_pypy.cffi_tests.udir import udir +from extra_tests.cffi_tests.udir import udir import cffi diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_performance.py b/extra_tests/cffi_tests/embedding/test_performance.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/test_performance.py rename to extra_tests/cffi_tests/embedding/test_performance.py --- a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_performance.py +++ b/extra_tests/cffi_tests/embedding/test_performance.py @@ -1,6 +1,6 @@ # Generated by pypy/tool/import_cffi.py import sys -from pypy.module.test_lib_pypy.cffi_tests.embedding.test_basic import EmbeddingTests +from extra_tests.cffi_tests.embedding.test_basic import EmbeddingTests if sys.platform == 'win32': import py diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_recursive.py b/extra_tests/cffi_tests/embedding/test_recursive.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/test_recursive.py rename to extra_tests/cffi_tests/embedding/test_recursive.py --- a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_recursive.py +++ b/extra_tests/cffi_tests/embedding/test_recursive.py @@ -1,5 +1,5 @@ # Generated by pypy/tool/import_cffi.py -from pypy.module.test_lib_pypy.cffi_tests.embedding.test_basic import EmbeddingTests +from extra_tests.cffi_tests.embedding.test_basic import EmbeddingTests class TestRecursive(EmbeddingTests): diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_thread.py b/extra_tests/cffi_tests/embedding/test_thread.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/test_thread.py rename to extra_tests/cffi_tests/embedding/test_thread.py --- a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_thread.py +++ b/extra_tests/cffi_tests/embedding/test_thread.py @@ -1,12 +1,12 @@ # Generated by pypy/tool/import_cffi.py -from pypy.module.test_lib_pypy.cffi_tests.embedding.test_basic import EmbeddingTests +from extra_tests.cffi_tests.embedding.test_basic import EmbeddingTests class TestThread(EmbeddingTests): def test_first_calls_in_parallel(self): add1_cffi = self.prepare_module('add1') self.compile('thread1-test', [add1_cffi], threads=True) - for i in range(50): + for i in range(20): output = self.execute('thread1-test') assert output == ("starting\n" "preparing...\n" + diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_tlocal.py b/extra_tests/cffi_tests/embedding/test_tlocal.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/test_tlocal.py rename to extra_tests/cffi_tests/embedding/test_tlocal.py --- a/pypy/module/test_lib_pypy/cffi_tests/embedding/test_tlocal.py +++ b/extra_tests/cffi_tests/embedding/test_tlocal.py @@ -1,5 +1,5 @@ # Generated by pypy/tool/import_cffi.py -from pypy.module.test_lib_pypy.cffi_tests.embedding.test_basic import EmbeddingTests +from extra_tests.cffi_tests.embedding.test_basic import EmbeddingTests class TestThreadLocal(EmbeddingTests): diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/thread-test.h b/extra_tests/cffi_tests/embedding/thread-test.h rename from pypy/module/test_lib_pypy/cffi_tests/embedding/thread-test.h rename to extra_tests/cffi_tests/embedding/thread-test.h diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/thread1-test.c b/extra_tests/cffi_tests/embedding/thread1-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/thread1-test.c rename to extra_tests/cffi_tests/embedding/thread1-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/thread2-test.c b/extra_tests/cffi_tests/embedding/thread2-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/thread2-test.c rename to extra_tests/cffi_tests/embedding/thread2-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/thread3-test.c b/extra_tests/cffi_tests/embedding/thread3-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/thread3-test.c rename to extra_tests/cffi_tests/embedding/thread3-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/tlocal-test.c b/extra_tests/cffi_tests/embedding/tlocal-test.c rename from pypy/module/test_lib_pypy/cffi_tests/embedding/tlocal-test.c rename to extra_tests/cffi_tests/embedding/tlocal-test.c diff --git a/pypy/module/test_lib_pypy/cffi_tests/embedding/tlocal.py b/extra_tests/cffi_tests/embedding/tlocal.py rename from pypy/module/test_lib_pypy/cffi_tests/embedding/tlocal.py rename to extra_tests/cffi_tests/embedding/tlocal.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/support.py b/extra_tests/cffi_tests/support.py rename from pypy/module/test_lib_pypy/cffi_tests/support.py rename to extra_tests/cffi_tests/support.py --- a/pypy/module/test_lib_pypy/cffi_tests/support.py +++ b/extra_tests/cffi_tests/support.py @@ -9,7 +9,7 @@ return eval('u'+repr(other).replace(r'\\u', r'\u') .replace(r'\\U', r'\U')) u = U() - long = long # for further "from pypy.module.test_lib_pypy.cffi_tests.support import long" + long = long # for further "from extra_tests.cffi_tests.support import long" assert u+'a\x00b' == eval(r"u'a\x00b'") assert u+'a\u1234b' == eval(r"u'a\u1234b'") assert u+'a\U00012345b' == eval(r"u'a\U00012345b'") diff --git a/pypy/module/test_lib_pypy/cffi_tests/test_egg_version.py b/extra_tests/cffi_tests/test_egg_version.py rename from pypy/module/test_lib_pypy/cffi_tests/test_egg_version.py rename to extra_tests/cffi_tests/test_egg_version.py diff --git a/pypy/module/test_lib_pypy/cffi_tests/udir.py b/extra_tests/cffi_tests/udir.py rename from pypy/module/test_lib_pypy/cffi_tests/udir.py rename to extra_tests/cffi_tests/udir.py diff --git a/extra_tests/test_interpreter.py b/extra_tests/test_interpreter.py new file mode 100644 --- /dev/null +++ b/extra_tests/test_interpreter.py @@ -0,0 +1,36 @@ +from __future__ import print_function +import pytest + +@pytest.fixture +def testfile(tmpdir): + tmpfile = tmpdir.join('test_execution_context') + tmpfile.write(""" +from __future__ import print_function +import gc +class X(object): + def __del__(self): + print("Called", self.num) +def f(): + x1 = X(); x1.num = 1 + x2 = X(); x2.num = 2 + x1.next = x2 +f() +gc.collect() +gc.collect() +""") + return tmpfile + + +def test_del_not_blocked(testfile): + # test the behavior fixed in r71420: before, only one __del__ + # would be called + import os, sys + if sys.platform == "win32": + cmdformat = '"%s" "%s"' + else: + cmdformat = "'%s' '%s'" + g = os.popen(cmdformat % (sys.executable, testfile), 'r') + data = g.read() + g.close() + assert 'Called 1' in data + assert 'Called 2' in data diff --git a/lib_pypy/cffi/cparser.py b/lib_pypy/cffi/cparser.py --- a/lib_pypy/cffi/cparser.py +++ b/lib_pypy/cffi/cparser.py @@ -137,6 +137,14 @@ parts.append(csource) return ''.join(parts) +def _warn_for_string_literal(csource): + if '"' in csource: + import warnings + warnings.warn("String literal found in cdef() or type source. " + "String literals are ignored here, but you should " + "remove them anyway because some character sequences " + "confuse pre-parsing.") + def _preprocess(csource): # Remove comments. NOTE: this only work because the cdef() section # should not contain any string literal! @@ -148,6 +156,7 @@ macrovalue = macrovalue.replace('\\\n', '').strip() macros[macroname] = macrovalue csource = _r_define.sub('', csource) + _warn_for_string_literal(csource) # if pycparser.__version__ < '2.14': csource = _workaround_for_old_pycparser(csource) diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -1073,6 +1073,7 @@ " foo = True\n") +@py.test.mark.skipif('config.getoption("runappdirect")') class AppTestAppMain: def setup_class(self): # ---------------------------------------- diff --git a/pypy/interpreter/test/test_executioncontext.py b/pypy/interpreter/test/test_executioncontext.py --- a/pypy/interpreter/test/test_executioncontext.py +++ b/pypy/interpreter/test/test_executioncontext.py @@ -42,7 +42,7 @@ class Action1(executioncontext.AsyncAction): def perform(self, ec, frame): events.append('one') - + class Action2(executioncontext.AsyncAction): def perform(self, ec, frame): events.append('two') @@ -75,7 +75,7 @@ class Action1(executioncontext.AsyncAction): _count = 0 - + def perform(self, ec, frame): events.append('one') if self._count == 0: @@ -138,11 +138,11 @@ def test_llprofile(self): l = [] - + def profile_func(space, w_arg, frame, event, w_aarg): assert w_arg is space.w_None l.append(event) - + space = self.space space.getexecutioncontext().setllprofile(profile_func, space.w_None) space.appexec([], """(): @@ -156,7 +156,7 @@ l = [] seen = [] space = self.space - + def profile_func(space, w_arg, frame, event, w_func): assert w_arg is space.w_None l.append(event) @@ -190,10 +190,10 @@ check_snippet('max(1, 2, **{})', 'builtin max') check_snippet('args = (1, 2); max(*args, **{})', 'builtin max') check_snippet('abs(val=0)', 'builtin abs') - + def test_llprofile_c_exception(self): l = [] - + def profile_func(space, w_arg, frame, event, w_aarg): assert w_arg is space.w_None l.append(event) @@ -308,7 +308,7 @@ space = self.space w_res = space.appexec([], """(): l = [] - + def profile(*args): l.append(sys.exc_info()[0]) @@ -327,45 +327,6 @@ """) -class AppTestDelNotBlocked: - - def setup_method(self, meth): - if not self.runappdirect: - py.test.skip("test is meant for running with py.test -A") - from rpython.tool.udir import udir - tmpfile = udir.join('test_execution_context') - tmpfile.write(""" -import gc -class X(object): - def __del__(self): - print("Called", self.num) -def f(): - x1 = X(); x1.num = 1 - x2 = X(); x2.num = 2 - x1.next = x2 -f() -gc.collect() -gc.collect() -""") - self.tmpfile = str(tmpfile) - self.w_tmpfile = self.space.wrap(self.tmpfile) - - def test_del_not_blocked(self): - # test the behavior fixed in r71420: before, only one __del__ - # would be called - import os, sys - print(sys.executable, self.tmpfile) - if sys.platform == "win32": - cmdformat = '"%s" "%s"' - else: - cmdformat = "'%s' '%s'" - g = os.popen(cmdformat % (sys.executable, self.tmpfile), 'r') - data = g.read() - g.close() - assert 'Called 1' in data - assert 'Called 2' in data - - class AppTestProfile: def test_return(self): diff --git a/pypy/module/_cppyy/test/conftest.py b/pypy/module/_cppyy/test/conftest.py --- a/pypy/module/_cppyy/test/conftest.py +++ b/pypy/module/_cppyy/test/conftest.py @@ -1,4 +1,7 @@ import py, sys +from os.path import abspath, commonprefix, dirname + +THIS_DIR = dirname(__file__) @py.test.mark.tryfirst def pytest_runtest_setup(item): @@ -29,10 +32,11 @@ py.test.skip(infomsg) def pytest_ignore_collect(path, config): + path = str(path) if py.path.local.sysfind('genreflex') is None and config.option.runappdirect: - return True # "can't run dummy tests in -A" + return commonprefix([path, THIS_DIR]) == THIS_DIR if disabled: - return True + return commonprefix([path, THIS_DIR]) == THIS_DIR disabled = None diff --git a/pypy/module/_warnings/test/test_warnings.py b/pypy/module/_warnings/test/test_warnings.py --- a/pypy/module/_warnings/test/test_warnings.py +++ b/pypy/module/_warnings/test/test_warnings.py @@ -61,18 +61,22 @@ except ImportError: skip('no test, -A on cpython?') # With showarning() missing, make sure that output is okay. - del warnings.showwarning + saved = warnings.showwarning + try: + del warnings.showwarning - stderr = sys.stderr - try: - sys.stderr = io.StringIO() - inner('test message') - result = sys.stderr.getvalue() + stderr = sys.stderr + try: + sys.stderr = io.StringIO() + inner('test message') + result = sys.stderr.getvalue() + finally: + sys.stderr = stderr + + assert result.count('\n') == 2 + assert ' warnings.warn(message, ' in result finally: - sys.stderr = stderr - - assert result.count('\n') == 2 - assert ' warnings.warn(message, ' in result + warnings.showwarning = saved def test_filename_none(self): import _warnings diff --git a/pypy/tool/import_cffi.py b/pypy/tool/import_cffi.py --- a/pypy/tool/import_cffi.py +++ b/pypy/tool/import_cffi.py @@ -11,7 +11,7 @@ if ext == '.py': yield "# Generated by pypy/tool/import_cffi.py\n" for line in lines: - line = line.replace('from testing', 'from pypy.module.test_lib_pypy.cffi_tests') + line = line.replace('from testing', 'from extra_tests.cffi_tests') yield line elif ext in ('.c', '.h'): yield "/* Generated by pypy/tool/import_cffi.py */\n" @@ -22,10 +22,10 @@ def main(cffi_dir): cffi_dir = py.path.local(cffi_dir) - pypydir = py.path.local(__file__).join('..', '..') - cffi_dest = pypydir.join('..', 'lib_pypy', 'cffi') + rootdir = py.path.local(__file__).join('..', '..', '..') + cffi_dest = rootdir / 'lib_pypy' / 'cffi' cffi_dest.ensure(dir=1) - test_dest = pypydir.join('module', 'test_lib_pypy', 'cffi_tests') + test_dest = rootdir / 'extra_tests' / 'cffi_tests' test_dest.ensure(dir=1) for p in (list(cffi_dir.join('cffi').visit(fil='*.py')) + list(cffi_dir.join('cffi').visit(fil='*.h'))): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit