[pypy-commit] pypy py3tests: hg merge py3.5

rlamy pypy.commits at gmail.com
Tue Nov 20 15:47:14 EST 2018


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3tests
Changeset: r95353:5bc653be8f68
Date: 2018-11-20 20:26 +0000
http://bitbucket.org/pypy/pypy/changeset/5bc653be8f68/

Log:	hg merge py3.5

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
--- 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
@@ -4,7 +4,7 @@
 from cffi import cffi_opcode
 
 if '__pypy__' in sys.builtin_module_names:
-    py.test.skip("not available on pypy")
+    py.test.skip("not available on pypy", allow_module_level=True)
 
 cffi_dir = os.path.dirname(cffi_opcode.__file__)
 
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
+
+ at 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")
 
 
+ at 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/_io/test/test_bufferedio.py b/pypy/module/_io/test/test_bufferedio.py
--- a/pypy/module/_io/test/test_bufferedio.py
+++ b/pypy/module/_io/test/test_bufferedio.py
@@ -169,12 +169,12 @@
             #
             exc = raises(TypeError, readinto, u"hello")
             msg = str(exc.value)
-            print(msg)
+            # print(msg)
             assert " read-write b" in msg and msg.endswith(", not str")
             #
             exc = raises(TypeError, readinto, memoryview(b"hello"))
             msg = str(exc.value)
-            print(msg)
+            # print(msg)
             assert " read-write b" in msg and msg.endswith(", not memoryview")
             #
             f.close()
diff --git a/pypy/module/_io/test/test_bytesio.py b/pypy/module/_io/test/test_bytesio.py
--- a/pypy/module/_io/test/test_bytesio.py
+++ b/pypy/module/_io/test/test_bytesio.py
@@ -111,12 +111,12 @@
             #
             exc = raises(TypeError, readinto, u"hello")
             msg = str(exc.value)
-            print(msg)
+            # print(msg)
             assert " read-write b" in msg and msg.endswith(", not str")
             #
             exc = raises(TypeError, readinto, memoryview(b"hello"))
             msg = str(exc.value)
-            print(msg)
+            # print(msg)
             assert " read-write b" in msg and msg.endswith(", not memoryview")
             #
             b.close()
diff --git a/pypy/module/_io/test/test_fileio.py b/pypy/module/_io/test/test_fileio.py
--- a/pypy/module/_io/test/test_fileio.py
+++ b/pypy/module/_io/test/test_fileio.py
@@ -164,12 +164,12 @@
         #
         exc = raises(TypeError, f.readinto, u"hello")
         msg = str(exc.value)
-        print(msg)
+        # print(msg)
         assert " read-write b" in msg and msg.endswith(", not str")
         #
         exc = raises(TypeError, f.readinto, memoryview(b"hello"))
         msg = str(exc.value)
-        print(msg)
+        # print(msg)
         assert " read-write b" in msg and msg.endswith(", not memoryview")
         #
         f.close()
diff --git a/pypy/module/_rawffi/alt/test/test_ffitype.py b/pypy/module/_rawffi/alt/test/test_ffitype.py
--- a/pypy/module/_rawffi/alt/test/test_ffitype.py
+++ b/pypy/module/_rawffi/alt/test/test_ffitype.py
@@ -1,6 +1,5 @@
-from pypy.module._rawffi.alt.test.test_funcptr import BaseAppTestFFI
-
-class AppTestFFIType(BaseAppTestFFI):
+class AppTestFFIType(object):
+    spaceconfig = dict(usemodules=('_rawffi',))
 
     def test_simple_types(self):
         from _rawffi.alt import types
@@ -8,7 +7,7 @@
         assert str(types.uint) == "<ffi type uint>"
         assert types.sint.name == 'sint'
         assert types.uint.name == 'uint'
-        
+
     def test_sizeof(self):
         from _rawffi.alt import types
         assert types.sbyte.sizeof() == 1
@@ -36,4 +35,3 @@
         assert x is types.char_p
         x = types.Pointer(types.unichar)
         assert x is types.unichar_p
-
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/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
@@ -179,6 +179,10 @@
             lltype.free(self._buffer, flavor='raw')
 
     def setlen(self, size, zero=False, overallocate=True):
+        if self._buffer:
+            delta_memory_pressure = -self.allocated * self.itemsize
+        else:
+            delta_memory_pressure = 0
         if size > 0:
             if size > self.allocated or size < self.allocated / 2:
                 if overallocate:
@@ -191,14 +195,13 @@
                     some = 0
                 self.allocated = size + some
                 byte_size = self.allocated * self.itemsize
+                delta_memory_pressure += byte_size
                 if zero:
                     new_buffer = lltype.malloc(
-                        rffi.CCHARP.TO, byte_size, flavor='raw',
-                        add_memory_pressure=True, zero=True)
+                        rffi.CCHARP.TO, byte_size, flavor='raw', zero=True)
                 else:
                     new_buffer = lltype.malloc(
-                        rffi.CCHARP.TO, byte_size, flavor='raw',
-                        add_memory_pressure=True)
+                        rffi.CCHARP.TO, byte_size, flavor='raw')
                     copy_bytes = min(size, self.len) * self.itemsize
                     rffi.c_memcpy(rffi.cast(rffi.VOIDP, new_buffer),
                                   rffi.cast(rffi.VOIDP, self._buffer),
@@ -215,6 +218,11 @@
             lltype.free(self._buffer, flavor='raw')
         self._buffer = new_buffer
         self.len = size
+        # adds the difference between the old and the new raw-malloced
+        # size.  If setlen() is called a lot on the same array object,
+        # it is important to take into account the fact that we also do
+        # lltype.free() above.
+        rgc.add_memory_pressure(delta_memory_pressure)
 
     def _fromiterable(self, w_seq):
         # used by fromsequence().
@@ -259,8 +267,10 @@
             return None
         oldbuffer = self._buffer
         self._buffer = lltype.malloc(rffi.CCHARP.TO,
-            (self.len - (j - i)) * self.itemsize, flavor='raw',
-            add_memory_pressure=True)
+            (self.len - (j - i)) * self.itemsize, flavor='raw')
+        # Issue #2913: don't pass add_memory_pressure here, otherwise
+        # memory pressure grows but actual raw memory usage doesn't---we
+        # are freeing the old buffer at the end of this function.
         if i:
             rffi.c_memcpy(
                 rffi.cast(rffi.VOIDP, self._buffer),
diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py
--- a/pypy/module/cpyext/test/test_unicodeobject.py
+++ b/pypy/module/cpyext/test/test_unicodeobject.py
@@ -677,13 +677,15 @@
     def test_decode_null_encoding(self, space):
         null_charp = lltype.nullptr(rffi.CCHARP.TO)
         u_text = u'abcdefg'
-        s_text = space.str_w(PyUnicode_AsEncodedString(space, space.wrap(u_text), null_charp, null_charp))
+        s_text = space.bytes_w(PyUnicode_AsEncodedString(space, space.wrap(u_text), null_charp, null_charp))
         b_text = rffi.str2charp(s_text)
         assert space.unicode_w(PyUnicode_Decode(
             space, b_text, len(s_text), null_charp, null_charp)) == u_text
         with raises_w(space, TypeError):
             PyUnicode_FromEncodedObject(
                 space, space.wrap(u_text), null_charp, None)
+        assert space.unicode_w(PyUnicode_FromEncodedObject(
+            space, space.newbytes(s_text), null_charp, None)) == u_text
         rffi.free_charp(b_text)
 
     def test_mbcs(self, space):
diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py
--- a/pypy/module/cpyext/unicodeobject.py
+++ b/pypy/module/cpyext/unicodeobject.py
@@ -486,11 +486,16 @@
     in the unicode() built-in function.  The codec to be used is looked up
     using the Python codec registry.  Return NULL if an exception was raised by
     the codec."""
-    if not encoding:
-        # This tracks CPython 2.7, in CPython 3.4 'utf-8' is hardcoded instead
-        encoding = PyUnicode_GetDefaultEncoding(space)
-    w_str = space.newbytes(rffi.charpsize2str(s, size))
-    w_encoding = space.newtext(rffi.charp2str(encoding))
+    return _pyunicode_decode(space, rffi.charpsize2str(s, size),
+                             encoding, errors)
+
+def _pyunicode_decode(space, s, encoding, errors):
+    if encoding:
+        w_encoding = space.newtext(rffi.charp2str(encoding))
+    else:
+        # python 3.4 changed to this from defaultencoding
+        w_encoding = space.newtext('utf-8')
+    w_str = space.newbytes(s)
     if errors:
         w_errors = space.newtext(rffi.charp2str(errors))
     else:
@@ -525,28 +530,17 @@
 
     All other objects, including Unicode objects, cause a TypeError to be
     set."""
-    if not encoding:
-        raise oefmt(space.w_TypeError, "decoding Unicode is not supported")
-    w_encoding = space.newtext(rffi.charp2str(encoding))
-    if errors:
-        w_errors = space.newtext(rffi.charp2str(errors))
+    if space.isinstance_w(w_obj, space.w_bytes):
+        s = space.bytes_w(w_obj)
+        if not s:
+            return space.newtext('')
+    elif space.isinstance_w(w_obj, space.w_unicode):
+        raise oefmt(space.w_TypeError, "decoding str is not supported")
+    elif space.isinstance_w(w_obj, space.w_bytearray):   # Python 2.x specific
+        raise oefmt(space.w_TypeError, "decoding bytearray is not supported")
     else:
-        w_errors = None
-
-    # - unicode is disallowed
-    # - raise TypeError for non-string types
-    if space.isinstance_w(w_obj, space.w_unicode):
-        w_meth = None
-    else:
-        try:
-            w_meth = space.getattr(w_obj, space.newtext('decode'))
-        except OperationError as e:
-            if not e.match(space, space.w_AttributeError):
-                raise
-            w_meth = None
-    if w_meth is None:
-        raise oefmt(space.w_TypeError, "decoding Unicode is not supported")
-    return space.call_function(w_meth, w_encoding, w_errors)
+        s = space.charbuf_w(w_obj)
+    return _pyunicode_decode(space, s, encoding, errors)
 
 
 @cpython_api([PyObject, PyObjectP], rffi.INT_real, error=0)
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -227,9 +227,9 @@
     def test_pickle(self):
         import pickle, os
         st = self.posix.stat(os.curdir)
-        print(type(st).__module__)
+        # print(type(st).__module__)
         s = pickle.dumps(st)
-        print(repr(s))
+        # print(repr(s))
         new = pickle.loads(s)
         assert new == st
         assert type(new) is type(st)
@@ -573,6 +573,12 @@
             res = fp.read()
             assert res == '1\n'
 
+    if sys.platform == "win32":
+        # using startfile in app_startfile creates global state
+        test_popen.dont_track_allocations = True
+        test_popen_with.dont_track_allocations = True
+        test_popen_child_fds.dont_track_allocations = True
+
     if hasattr(__import__(os.name), '_getfullpathname'):
         def test__getfullpathname(self):
             # nt specific
diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py
--- a/pypy/module/sys/initpath.py
+++ b/pypy/module/sys/initpath.py
@@ -236,8 +236,8 @@
 #endif
 #include <windows.h>
 #include <stdio.h>
+#include <stdlib.h>
 
-RPY_EXPORTED
 char *_pypy_init_home(void)
 {
     HMODULE hModule = 0;
@@ -273,7 +273,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-RPY_EXPORTED
 char *_pypy_init_home(void)
 {
     Dl_info info;
@@ -291,11 +290,27 @@
 }
 """
 
+_source_code += """
+inline
+void _pypy_init_free(char *p)
+{
+    free(p);
+}
+"""
+
+if we_are_translated():
+   post_include_bits = []
+else:
+    # for tests 
+    post_include_bits=['RPY_EXPORTED char *_pypy_init_home(void);',
+                       'RPY_EXPORTED void _pypy_init_free(char*);',
+                      ]
+
 _eci = ExternalCompilationInfo(separate_module_sources=[_source_code],
-    post_include_bits=['RPY_EXPORTED char *_pypy_init_home(void);'])
+                               post_include_bits=post_include_bits)
 _eci = _eci.merge(rdynload.eci)
 
 pypy_init_home = rffi.llexternal("_pypy_init_home", [], rffi.CCHARP,
                                  _nowrapper=True, compilation_info=_eci)
-pypy_init_free = rffi.llexternal("free", [rffi.CCHARP], lltype.Void,
+pypy_init_free = rffi.llexternal("_pypy_init_free", [rffi.CCHARP], lltype.Void,
                                  _nowrapper=True, compilation_info=_eci)
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'))):
diff --git a/rpython/translator/platform/windows.py b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -85,6 +85,9 @@
             stdout, stderr = popen.communicate()
             if popen.wait() != 0:
                 return None
+            if stdout[:5].lower() == 'error':
+                log.msg('Running "%s" errored: %s' %(vcvars, stdout.split()[0]))
+                return None
         except:
             return None
 


More information about the pypy-commit mailing list