Skip to content

Commit be7ebe0

Browse files
committed
tests: Remove tests as required on review
1 parent fb86cbe commit be7ebe0

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

Lib/test/test_codeop.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
99
import io
10-
import weakref
1110

1211
if is_jython:
1312
import sys
@@ -295,22 +294,6 @@ def test_filename(self):
295294
self.assertNotEqual(compile_command("a = 1\n", "abc").co_filename,
296295
compile("a = 1\n", "def", 'single').co_filename)
297296

298-
def test_invalid_doesnt_keep_user_object_alive(self):
299-
'''succeed iff str is the start of an invalid piece of code'''
300-
class A: pass
301-
obj_wr = None
302-
303-
def x():
304-
nonlocal obj_wr
305-
obj = A()
306-
obj_wr = weakref.ref(obj)
307-
try:
308-
compile_command("invalid syntax =")
309-
except SyntaxError:
310-
pass
311-
x()
312-
assert obj_wr() is None
313-
314297

315298
if __name__ == "__main__":
316299
unittest.main()

Lib/test/test_socket.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import platform
1616
import array
1717
import contextlib
18-
import weakref
18+
from weakref import proxy
1919
import signal
2020
import math
2121
import pickle
@@ -850,7 +850,7 @@ def test_csocket_repr(self):
850850

851851
def test_weakref(self):
852852
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
853-
p = weakref.proxy(s)
853+
p = proxy(s)
854854
self.assertEqual(p.fileno(), s.fileno())
855855
s = None
856856
try:
@@ -1882,25 +1882,6 @@ def test_socket_fileno_requires_valid_fd(self):
18821882
fileno=support.make_bad_fd())
18831883
self.assertIn(cm.exception.errno, (errno.EBADF, WSAENOTSOCK))
18841884

1885-
def testCreateConnectionDoesntCreateCycles(self):
1886-
# `socket.create_connection` saves the exception in a
1887-
# variable to then re-raise, which caused a cycle
1888-
# and kept objects in upper frames alive unnecesarily.
1889-
port = support.find_unused_port()
1890-
class A: pass
1891-
obj_wr = None
1892-
1893-
def x():
1894-
nonlocal obj_wr
1895-
obj = A()
1896-
obj_wr = weakref.ref(obj)
1897-
try:
1898-
socket.create_connection((HOST, port))
1899-
except OSError:
1900-
pass
1901-
x()
1902-
assert obj_wr() is None
1903-
19041885
def test_socket_fileno_requires_socket_fd(self):
19051886
with tempfile.NamedTemporaryFile() as afile:
19061887
with self.assertRaises(OSError):

0 commit comments

Comments
 (0)