summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socketserver.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-09-17 23:56:20 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-09-17 23:56:20 (GMT)
commita9f6f22f72833e49d01539f37effab67aa21391b (patch)
tree24234335a140c0b5a2ec45e3008e1648aea8b0d7 /Lib/test/test_socketserver.py
parentd9d1d4ac6fda7f4c898b55194be37b03b89450e9 (diff)
downloadcpython-a9f6f22f72833e49d01539f37effab67aa21391b.zip
cpython-a9f6f22f72833e49d01539f37effab67aa21391b.tar.gz
cpython-a9f6f22f72833e49d01539f37effab67aa21391b.tar.bz2
Rework akin to test_threaded_import, so that this can run under regrtest.
Also raise TestSkipped (intead of appearing to fail) if the import lock is held.
Diffstat (limited to 'Lib/test/test_socketserver.py')
-rw-r--r--Lib/test/test_socketserver.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 398b077..6bce9b3 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -1,11 +1,6 @@
# Test suite for SocketServer.py
-# XXX This must be run manually -- somehow the I/O redirection of the
-# regression test breaks the test.
-
from test_support import verbose, verify, TESTFN, TestSkipped
-if not verbose:
- raise TestSkipped, "test_socketserver can only be run manually"
from SocketServer import *
import socket
@@ -153,10 +148,16 @@ def testall():
# client address so this cannot work:
##testloop(socket.AF_UNIX, dgramservers, MyDatagramHandler, testdgram)
-def main():
+def test_main():
+ import imp
+ if imp.lock_held():
+ # If the import lock is held, the threads will hang.
+ raise TestSkipped("can't run when import lock is held")
+
try:
testall()
finally:
cleanup()
-main()
+if __name__ == "__main__":
+ test_main()