Skip to content

[3.6] bpo-30106: Fix test_asyncore.test_quick_connect() #1336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 28, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-30106: Fix tearDown() of test_asyncore (#1194)
Call asyncore.close_all() with ignore_all=True in the tearDown()
method of the test_asyncore base test case. It should prevent keeping
alive sockets in asyncore.socket_map if close() fails with an
unexpected error.

Revert also an unwanted change of my previous commit: remove name
parameter of Thread in test_quick_connect().
  • Loading branch information
vstinner committed Apr 28, 2017
commit fed2a0529c995a93e6a562e07740de0d5867e666
4 changes: 2 additions & 2 deletions Lib/test/test_asyncore.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def handle_connect(self):
class BaseTestAPI:

def tearDown(self):
asyncore.close_all()
asyncore.close_all(ignore_all=True)

def loop_waiting_for_flag(self, instance, timeout=5):
timeout = float(timeout) / 100
Expand Down Expand Up @@ -782,7 +782,7 @@ def test_quick_connect(self):

server = BaseServer(self.family, self.addr)
t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1,
count=500), name="ident")
count=500))
t.start()
try:
with socket.socket(self.family, socket.SOCK_STREAM) as s:
Expand Down