Skip to content

Commit

Permalink
The gc.collect() bandaid should not be necessary
Browse files Browse the repository at this point in the history
I'm not brave enough to remove it, but at least let's indicate that it's
not expected to be executed during test runs with a pragma: no cover.
  • Loading branch information
mgedmin committed Oct 19, 2018
1 parent 4052bbe commit 2248a10
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/zope/server/tests/__init__.py
Expand Up @@ -22,11 +22,13 @@ def setUp(self):
super(LoopTestMixin, self).setUp()
td = self.td = ThreadedTaskDispatcher()
td.setThreadCount(self.task_dispatcher_count)
if len(asyncore.socket_map) != 1:
if len(asyncore.socket_map) != 1: # pragma: no cover
# Let sockets die off.
# TODO tests should be more careful to clear the socket map.
# (tests should be more careful to clear the socket map, and they
# currently do, but let's keep this backstop just in case, to avoid
# confusing failures).
gc.collect()
asyncore.poll(0.1) # pragma: no cover
asyncore.poll(0.1)
self.orig_map_size = len(asyncore.socket_map)

self.server = self._makeServer()
Expand Down

0 comments on commit 2248a10

Please sign in to comment.