'Try to save previous ulimit, then set it to (0, 0).'

def __enter__(self):

    try:
        import resource
        self.old_limit = resource.getrlimit(resource.RLIMIT_CORE)
        resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
    except (ImportError, ValueError, resource.error):
        pass
    if (sys.platform == 'darwin'):
        value = subprocess.Popen(['/usr/bin/defaults', 'read', 'com.apple.CrashReporter', 'DialogType'], stdout=subprocess.PIPE).communicate()[0]
        if (value.strip() == 'developer'):
            print 'this    tests    triggers    the    Crash    Reporter,    that    is    intentional'
            sys.stdout.flush()
