mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
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.
This commit is contained in:
parent
d9d1d4ac6f
commit
a9f6f22f72
1 changed files with 8 additions and 7 deletions
|
@ -1,11 +1,6 @@
|
||||||
# Test suite for SocketServer.py
|
# 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
|
from test_support import verbose, verify, TESTFN, TestSkipped
|
||||||
if not verbose:
|
|
||||||
raise TestSkipped, "test_socketserver can only be run manually"
|
|
||||||
|
|
||||||
from SocketServer import *
|
from SocketServer import *
|
||||||
import socket
|
import socket
|
||||||
|
@ -153,10 +148,16 @@ def testall():
|
||||||
# client address so this cannot work:
|
# client address so this cannot work:
|
||||||
##testloop(socket.AF_UNIX, dgramservers, MyDatagramHandler, testdgram)
|
##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:
|
try:
|
||||||
testall()
|
testall()
|
||||||
finally:
|
finally:
|
||||||
cleanup()
|
cleanup()
|
||||||
|
|
||||||
main()
|
if __name__ == "__main__":
|
||||||
|
test_main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue