Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

cffi_tests.cffi0.test_zdistutils.TestDistUtilsGeneric:test_install_and_reload_module

self = <extra_tests.cffi_tests.cffi0.test_zdistutils.TestDistUtilsGeneric object at 0x00007fc5ebafd7f8>
targetpackage = '', ext_package = ''

    def test_install_and_reload_module(self, targetpackage='', ext_package=''):
        KEY = repr(self)
        if not hasattr(os, 'fork'):
            pytest.skip("test requires os.fork()")
    
        if targetpackage:
            udir.ensure(targetpackage, dir=1).ensure('__init__.py')
        sys.path.insert(0, str(udir))
    
        def make_ffi(**verifier_args):
            ffi = FFI()
            ffi.cdef("/* %s, %s, %s */" % (KEY, targetpackage, ext_package))
            ffi.cdef("double test1iarm(double x);")
            csrc = "double test1iarm(double x) { return x * 42.0; }"
            lib = ffi.verify(csrc, force_generic_engine=self.generic,
                             ext_package=ext_package,
                             **verifier_args)
            return ffi, lib
    
        childpid = os.fork()
        if childpid == 0:
            # in the child
            ffi, lib = make_ffi()
            assert lib.test1iarm(1.5) == 63.0
            # "install" the module by moving it into udir (/targetpackage)
            if targetpackage:
                target = udir.join(targetpackage)
            else:
                target = udir
            shutil.move(ffi.verifier.modulefilename, str(target))
            os._exit(0)
        # in the parent
        _, status = os.waitpid(childpid, 0)
        if not (os.WIFEXITED(status) and os.WEXITSTATUS(status) == 0):
>           raise AssertionError   # see error above in subprocess
E           AssertionError

../build/extra_tests/cffi_tests/cffi0/test_zdistutils.py:240: AssertionError
builder: pypy-c-jit-macos-x86-64 build #1318+
test: cffi_tests.cffi0.test_zdistutils.TestDistUtilsGeneric:test_install_and_reload_module