[Python-3000] buildbots

Thomas Heller theller at ctypes.org
Thu Aug 30 08:08:40 CEST 2007


David Bolen schrieb:
> David Bolen <db3l.net at gmail.com> writes:
> 
>> "Martin v. Löwis" <martin at v.loewis.de> writes:
>>
>>>> These messageboxes of course hang the tests on the windows build servers,
>>>> so probably it would be good if they could be disabled completely.
>>>
>>> I think this will be very difficult to achieve.
>>
>> Could the tests be run beneath a shim process that used SetErrorMode()
>> to disable all the OS-based process failure dialog boxes?  If I
>> remember correctly the error mode is inherited, so an independent
>> small exec module could reset the mode, and execute the normal test
>> sequence as a child process.
> 
> Or if using ctypes is ok, perhaps it could be done right in the test
> runner.
> 
> While I haven't done any local mods to preventthe C RTL boxes,
> selecting Ignore on them gets me to the OS level box, and:
> 
> Python 3.0x (py3k, Aug 27 2007, 22:44:06) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import test_os
> [50256 refs]
>>>> test_os.test_main()
> 
> dies with popup in test_execvpe_with_bad_program (test_os.ExecTests).  But
> 
> Python 3.0x (py3k, Aug 27 2007, 22:44:06) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import ctypes
> [39344 refs]
>>>> ctypes.windll.kernel32.SetErrorMode(7)
> 0
> [40694 refs]
>>>> import test_os
> [55893 refs]
>>>> test_os.test_main()
> 
> doesn't present the OS popup prior to process exit.

Cool, this works!

I suggest to apply this patch, which sets an environment variable in the
Tools\buildbot\test.bat script, detects the Windows debug build, and calls
SetErrorMode(7) as David suggested:

Index: Lib/test/regrtest.py
===================================================================
--- Lib/test/regrtest.py	(revision 57666)
+++ Lib/test/regrtest.py	(working copy)
@@ -208,6 +208,15 @@
     flags on the command line.
     """
 
+    if sys.platform == "win32":
+        if "_d.pyd" in [s[0] for s in imp.get_suffixes()]:
+            # running is a debug build.
+            if os.environ.get("PYTEST_NONINTERACTIVE", ""):
+                # If the PYTEST_NONINTERACTIVE environment variable is
+                # set, we do not want any message boxes.
+                import ctypes
+                ctypes.windll.kernel32.SetErrorMode(7)
+
     test_support.record_original_stdout(sys.stdout)
     try:
         opts, args = getopt.getopt(sys.argv[1:], 'dhvgqxsS:rf:lu:t:TD:NLR:wM:',
Index: Tools/buildbot/test.bat
===================================================================
--- Tools/buildbot/test.bat	(revision 57666)
+++ Tools/buildbot/test.bat	(working copy)
@@ -1,3 +1,4 @@
 @rem Used by the buildbot "test" step.
 cd PCbuild
+set PYTEST_NONINTERACTIVE=1
 call rt.bat -d -q -uall -rw



Thomas



More information about the Python-3000 mailing list