PyMySQL/Tornado-MySQL

Get Exception socket.error: error(9, 'Bad file descriptor') in testing.

markduan opened this issue · 2 comments

Hello, INADA:
I write a class inherits pools.Pool names DBServer, and it is a singleton class. I also write a class DBServerTestCase that inherit AsyncTestCase.
This is part of DBServerTestCase:

class DBServerTestCase(AsyncTestCase):
    def setUp(self):
        super(DBServerTestCase, self).setUp()
        self.db = DBServer(dict(host='127.0.0.1', port=3306, user='root', passwd='root', db='mydatabase', cursorclass=DictCursor),
            max_idle_connections=2,
            max_recycle_sec=3,
            max_open_connections=5)

...Many test methods...

When I run this test case, I get many errors like:

Exception socket.error: error(9, 'Bad file descriptor') in <bound method Connection.__del__ of <tornado_mysql.connections.Connection object at 0x106753ed0>> ignored

I don't override tearDown method.
If I just run one method, everything is fine, no error.
Is it appropriate that writing setUp method like this?

I also ran into this. Seems like I needed to make a new pools.Pool for every test case.

It may be resolved in master.