[pypy-commit] pypy default: try harder to avoid windows-app crashes opening a dialog box under buildbots

mattip noreply at buildbot.pypy.org
Fri Aug 29 09:05:14 CEST 2014


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r73156:716d587362cb
Date: 2014-08-29 10:03 +0300
http://bitbucket.org/pypy/pypy/changeset/716d587362cb/

Log:	try harder to avoid windows-app crashes opening a dialog box under
	buildbots

diff --git a/pypy/test_all.py b/pypy/test_all.py
--- a/pypy/test_all.py
+++ b/pypy/test_all.py
@@ -27,4 +27,21 @@
     sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
     import pytest
     import pytest_cov
+    if sys.platform == 'win32':
+        #Try to avoid opeing a dialog box if one of the tests causes a system error
+        # We do this in runner.py, but buildbots run twisted which ruins inheritance
+        # in windows subprocesses. 
+        import ctypes
+        winapi = ctypes.windll.kernel32
+        SetErrorMode = winapi.SetErrorMode
+        SetErrorMode.argtypes=[ctypes.c_int]
+
+        SEM_FAILCRITICALERRORS = 1
+        SEM_NOGPFAULTERRORBOX  = 2
+        SEM_NOOPENFILEERRORBOX = 0x8000
+        flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX
+        #Since there is no GetErrorMode, do a double Set
+        old_mode = SetErrorMode(flags)
+        SetErrorMode(old_mode | flags)
+
     sys.exit(pytest.main(plugins=[pytest_cov]))
diff --git a/testrunner/runner.py b/testrunner/runner.py
--- a/testrunner/runner.py
+++ b/testrunner/runner.py
@@ -407,7 +407,8 @@
     run_param.dry_run = opts.dry_run
 
     if run_param.dry_run:
-        print >>out, run_param.__dict__
+        print >>out, '\n'.join([str((k, getattr(run_param, k))) \
+                        for k in dir(run_param) if k[:2] != '__'])
     
     res = execute_tests(run_param, testdirs, logfile, out)
 


More information about the pypy-commit mailing list