[pypy-commit] pypy py3k: Port failing test from eea8f92e03.

mjacob pypy.commits at gmail.com
Fri Feb 26 19:39:09 EST 2016


Author: Manuel Jacob <me at manueljacob.de>
Branch: py3k
Changeset: r82579:a3d2806acab8
Date: 2016-02-27 01:23 +0100
http://bitbucket.org/pypy/pypy/changeset/a3d2806acab8/

Log:	Port failing test from eea8f92e03.

	eea8f92e03 should have been done in py3k. I'm going to apply the
	rpython changes to default to reduce differences between branches.
	After that I'll port the changes to fix the test.

diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -614,7 +614,7 @@
         import _socket
         self.foo = _socket.socket()
 
-    def test_subclass(self):
+    def test_subclass_init(self):
         # Socket is not created in __new__, but in __init__.
         import socket
         class Socket_IPV6(socket.socket):
@@ -622,6 +622,18 @@
                 socket.socket.__init__(self, family=socket.AF_INET6)
         assert Socket_IPV6().family == socket.AF_INET6
 
+    def test_subclass_noinit(self):
+        from _socket import socket
+        class MySock(socket):
+            def __init__(self, *args):
+                pass  # don't call super
+        s = MySock()
+        assert s.type == 0
+        assert s.proto == 0
+        assert s.family == 0
+        assert s.fileno() < 0
+        raises(OSError, s.bind, ('localhost', 0))
+
     def test_dealloc_warn(self):
         import _socket
         import gc


More information about the pypy-commit mailing list