test: delete handles and clean up in teardown
Without this, PyPy might not garbage collect the handles fast enough to
prevent hitting the open file limit.
@@ -70,3 +70,10 @@ class TestCase(unittest.TestCase):
def setUp(self):
self.loop = TestLoop()
+ def tearDown(self):
+ for handle in self.loop.handles:
+ try:
+ handle.close()
+ except:
+ pass
+ self.loop.run()
