def test_transactions(self): """examples/transactions.py""" db = mysql.connector.connect(**tests.get_mysql_config()) r = tests.have_engine(db, 'InnoDB') db.close() if not r: return try: import examples.transaction as example except Exception as e: self.fail(e) exp = '3bd75261ffeb5624cdd754a43e2fd938' self._exec_main(example, exp)
def test_transactions(self): """examples/transactions.py""" db = mysql.connector.connect(**tests.get_mysql_config()) r = tests.have_engine(db, 'InnoDB') db.close() if not r: return try: import examples.transaction as example except Exception as e: self.fail(e) output = self._exec_main(example) exp = ['Inserting data', 'Rolling back transaction', 'No data, all is fine.', 'Data before commit:', '4 | Geert', '5 | Jan', '6 | Michel', 'Data after commit:', '4 | Geert', '5 | Jan', '6 | Michel'] self.assertEqual(output, exp, 'Output was not correct')
def test_isolation2(self): """Cursor isolation with 2 cursors, different connections, trans.""" db2 = self.db_connect() if tests.have_engine(db2, 'InnoDB'): self._isolation_test(self.cnx, db2, 'InnoDB')