[Python-Dev] testing in a Python --without-threads build

Bill Janssen janssen at parc.com
Sat Sep 8 22:16:47 CEST 2007


> > Because regrtest.py was importing test_socket_ssl without catching the
> > ImportError exception:
> 
> If that is the reason you cannot run it, then it seems it works just
> fine. There is nothing wrong with tests getting skipped.

It wasn't getting skipped, it was crashing the regression testing harness.
test_unittest catches the ImportError, but this was imported directly
from regrtest.py.

> > So, is this an "expected skip" or not?
> 
> No. IIUC, "expected skips" are a platform property. For your platform,
> support for threads is expected (whatever your platform is as log as
> it was built in this millenium).

OK.  I'll put in a check for this.  In fact, here's a patch:

Index: Lib/test/regrtest.py
===================================================================
--- Lib/test/regrtest.py	(revision 58052)
+++ Lib/test/regrtest.py	(working copy)
@@ -1108,7 +1108,6 @@
 class _ExpectedSkips:
     def __init__(self):
         import os.path
-        from test import test_socket_ssl
         from test import test_timeout
 
         self.valid = False
@@ -1122,8 +1121,13 @@
             if not os.path.supports_unicode_filenames:
                 self.expected.add('test_pep277')
 
-            if test_socket_ssl.skip_expected:
-                self.expected.add('test_socket_ssl')
+            try:
+                from test import test_socket_ssl
+            except ImportError:
+                pass
+            else:
+                if test_socket_ssl.skip_expected:
+                    self.expected.add('test_socket_ssl')
 
             if test_timeout.skip_expected:
                 self.expected.add('test_timeout')


Bill


More information about the Python-Dev mailing list