| 1 |
import os |
| 2 |
import pytest |
| 3 |
import sys |
| 4 |
|
| 5 |
def pytest_configure(config): |
| 6 |
if config.getoption('runappdirect') or config.getoption('direct_apptest'): |
| 7 |
import py |
| 8 |
from pypy import pypydir |
| 9 |
sys.path.append(str(py.path.local(pypydir) / 'tool' / 'cpyext')) |
| 10 |
return |
| 11 |
from pypy.tool.pytest.objspace import gettestobjspace |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
space = gettestobjspace(usemodules=['time']) |
| 17 |
space.getbuiltinmodule("time") |
| 18 |
|
| 19 |
|
| 20 |
import pypy.module.cpyext.test.test_cpyext |
| 21 |
|
| 22 |
|
| 23 |
@pytest.fixture |
| 24 |
def api(request): |
| 25 |
return request.cls.api |
| 26 |
|
| 27 |
if os.name == 'nt': |
| 28 |
@pytest.yield_fixture(autouse=True, scope='session') |
| 29 |
def prevent_dialog_box(): |
| 30 |
"""Do not open dreaded dialog box on segfault on Windows""" |
| 31 |
import ctypes |
| 32 |
SEM_NOGPFAULTERRORBOX = 0x0002 |
| 33 |
old_err_mode = ctypes.windll.kernel32.GetErrorMode() |
| 34 |
new_err_mode = old_err_mode | SEM_NOGPFAULTERRORBOX |
| 35 |
ctypes.windll.kernel32.SetErrorMode(new_err_mode) |
| 36 |
yield |
| 37 |
ctypes.windll.kernel32.SetErrorMode(old_err_mode) |