Commit 24e4af8c authored by Guido van Rossum's avatar Guido van Rossum

New test suite for the socket module by Michael Gilfix.

Changed test_timeout.py to conform to the guidelines in Lib/test/README.
parent e3fdc975
test_socket
socket.error
23
This diff is collapsed.
#!/home/bernie/src/python23/dist/src/python #!/home/bernie/src/python23/dist/src/python
import unittest import unittest
import test_support
import time import time
import socket import socket
class creationTestCase(unittest.TestCase): class CreationTestCase(unittest.TestCase):
"""Test Case for socket.gettimeout() and socket.settimeout()""" """Test Case for socket.gettimeout() and socket.settimeout()"""
def setUp(self): def setUp(self):
self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
...@@ -39,7 +40,7 @@ class creationTestCase(unittest.TestCase): ...@@ -39,7 +40,7 @@ class creationTestCase(unittest.TestCase):
"return type of gettimeout() is not FloatType") "return type of gettimeout() is not FloatType")
class timeoutTestCase(unittest.TestCase): class TimeoutTestCase(unittest.TestCase):
"""Test Case for socket.socket() timeout functions""" """Test Case for socket.socket() timeout functions"""
def setUp(self): def setUp(self):
self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
...@@ -127,10 +128,11 @@ class timeoutTestCase(unittest.TestCase): ...@@ -127,10 +128,11 @@ class timeoutTestCase(unittest.TestCase):
pass pass
def suite(): def test_main():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(CreationTestCase))
return suite suite.addTest(unittest.makeSuite(TimeoutTestCase))
test_support.run_suite(suite)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() test_main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment