1. halgari
  2. pypy


pypy / pypy / module / test_lib_pypy / ctypes_tests / conftest.py

import py, pytest
import sys

def pytest_ignore_collect(path):
    if '__pypy__' not in sys.builtin_module_names:
        return True

def compile_so_file():
    from platformer import platform
    from platformer.cbuild import ExternalCompilationInfo
    udir = pytest.ensuretemp('_ctypes_test')
    cfile = py.path.local(__file__).dirpath().join("_ctypes_test.c")

    if sys.platform == 'win32':
        libraries = ['oleaut32']
        libraries = []
    eci = ExternalCompilationInfo(libraries=libraries)

    return platform.compile([cfile], eci, str(udir.join('_ctypes_test')),

# we need to run after the "tmpdir" plugin which installs pytest.ensuretemp
def pytest_configure(config):
    global sofile
    sofile = compile_so_file()