testSelectionTool: open connection in worker thread

In ZODB 5, with commit b6ac40f1 (Uses an unwrapped transaction manager,
2018-10-14) the transaction is bound to the thread opening the
connection.
The previous pattern of opening transaction in the main thread and
passing the already-open connection to the working thread caused the
working thread connection to be managed by the main thread connection
and in ZODB 5 cause the test to block.

Fix this by passing a connection factory method and opening
connection in working thread.
Also simplify closing of connection by using a closing context manager.
1 job for zope4py2 in 0 seconds
Status Job ID Name Coverage
  External
canceled ERP5.CodingStyleTest-Zope4Py2-Jerome

00:05:02