You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.{base.py:680} ERROR - Exception during reset or similar
Traceback (most recent call last):
File "/Users/romanhartmann/.virtualenvs/ub-data-product/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 671, in _finalize_fairy
fairy._reset(pool)
File "/Users/romanhartmann/.virtualenvs/ub-data-product/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 858, in _reset
pool._dialect.do_rollback(self)
File "/Users/romanhartmann/.virtualenvs/ub-data-product/lib/python3.6/site-packages/sqlalchemy/dialects/mysql/base.py", line 2227, in do_rollback
dbapi_connection.rollback()
File "/Users/romanhartmann/.virtualenvs/ub-data-product/lib/python3.6/site-packages/pymysql/connections.py", line 430, in rollback
self._read_ok_packet()
File "/Users/romanhartmann/.virtualenvs/ub-data-product/lib/python3.6/site-packages/pymysql/connections.py", line 394, in _read_ok_packet
pkt = self._read_packet()
File "/Users/romanhartmann/.virtualenvs/ub-data-product/lib/python3.6/site-packages/pymysql/connections.py", line 657, in _read_packet
packet_header = self._read_bytes(4)
File "/Users/romanhartmann/.virtualenvs/ub-data-product/lib/python3.6/site-packages/pymysql/connections.py", line 707, in _read_bytes
CR.CR_SERVER_LOST, "Lost connection to MySQL server during query")
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
This error did not cause any tests to fail, it was just being logged all the time.
I was using the exact same setup for testing.postgresql without the error.
I changed my test class to this to get rid of the error:
MYSQLD_FACTORY = testing.mysqld.MysqldFactory(cache_initialized_db=True, port=7531)
def tearDownModule():
"""Tear down databases after test script has run.
https://docs.python.org/3/library/unittest.html#setupclass-and-teardownclass
"""
MYSQLD_FACTORY.clear_cache()
class TestWhatever(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.mysql = MYSQLD_FACTORY()
cls.target_conn = create_engine(cls.mysql.url()).connect()
def setUp(self):
self.mysql.start()
self.target_conn.execute("""CREATE TABLE `foo` (blah)""")
def tearDown(self):
self.target_conn.execute("DROP TABLE foo")
@classmethod
def tearDownClass(cls):
cls.mysql.stop()
def test_something(self):
# something useful
Would you please update your documentation to either
Outline what I did wrong to prevent other people having to figure this out. I've seen a lot of SO posts about the vague pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query') error in relation to this package
Document this pattern as a working pattern
The text was updated successfully, but these errors were encountered:
First of all, thank you for wonderful work.
Following the quickstart at https://pypi.org/project/testing.mysqld/, I would get this very noisy error message:
My unit test setup was like this:
This error did not cause any tests to fail, it was just being logged all the time.
I was using the exact same setup for
testing.postgresql
without the error.I changed my test class to this to get rid of the error:
Would you please update your documentation to either
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
error in relation to this packageThe text was updated successfully, but these errors were encountered: