changeset: 85645:b91450e51388 user: Victor Stinner date: Tue Sep 24 22:48:06 2013 +0200 files: Lib/test/support/__init__.py description: implement test.support.suppress_crash_popup() on UNIX diff -r c27e81d8cc41 -r b91450e51388 Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py Tue Sep 24 20:35:07 2013 +0200 +++ b/Lib/test/support/__init__.py Tue Sep 24 22:48:06 2013 +0200 @@ -2009,10 +2009,16 @@ finally: k32.SetErrorMode(old_error_mode) else: + import resource # this is a no-op for other platforms @contextlib.contextmanager def suppress_crash_popup(): - yield + limit = resource.getrlimit(resource.RLIMIT_CORE) + try: + resource.setrlimit(resource.RLIMIT_CORE, (0, limit[1])) + yield + finally: + resource.setrlimit(resource.RLIMIT_CORE, limit) def patch(test_instance, object_to_patch, attr_name, new_value):