[Python-checkins] r47262 - python/trunk/Lib/ctypes/test/test_win32.py

thomas.heller python-checkins at python.org
Thu Jul 6 10:28:14 CEST 2006


Author: thomas.heller
Date: Thu Jul  6 10:28:14 2006
New Revision: 47262

Modified:
   python/trunk/Lib/ctypes/test/test_win32.py
Log:
The test that calls a function with invalid arguments and catches the
resulting Windows access violation will not be run by default.

Modified: python/trunk/Lib/ctypes/test/test_win32.py
==============================================================================
--- python/trunk/Lib/ctypes/test/test_win32.py	(original)
+++ python/trunk/Lib/ctypes/test/test_win32.py	Thu Jul  6 10:28:14 2006
@@ -1,6 +1,7 @@
 # Windows specific tests
 
 from ctypes import *
+from ctypes.test import is_resource_enabled
 import unittest, sys
 
 import _ctypes_test
@@ -30,15 +31,10 @@
             # or wrong calling convention
             self.assertRaises(ValueError, IsWindow, None)
 
-        def test_SEH(self):
-            # Call functions with invalid arguments, and make sure that access violations
-            # are trapped and raise an exception.
-            #
-            # Normally, in a debug build of the _ctypes extension
-            # module, exceptions are not trapped, so we can only run
-            # this test in a release build.
-            import sys
-            if not hasattr(sys, "getobjects"):
+        if is_resource_enabled("SEH"):
+            def test_SEH(self):
+                # Call functions with invalid arguments, and make sure that access violations
+                # are trapped and raise an exception.
                 self.assertRaises(WindowsError, windll.kernel32.GetModuleHandleA, 32)
 
 class Structures(unittest.TestCase):


More information about the Python-checkins mailing list