Skip to content

Commit 53c4e09

Browse files
Merge pull request julien-duponchelle#115 from vartec/no_gtid
skipping GTID tests on DBs not set up to support GTID
2 parents fe5d8f4 + 5ce0bd6 commit 53c4e09

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pymysqlreplication/tests/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def isMySQL56AndMore(self):
5555
return True
5656
return False
5757

58+
@property
59+
def supportsGTID(self):
60+
if not self.isMySQL56AndMore():
61+
return False
62+
return self.execute("SELECT @@global.gtid_mode ").fetchone()[0] == "ON"
63+
5864
def connect_conn_control(self, db):
5965
if self.conn_control is not None:
6066
self.conn_control.close()

pymysqlreplication/tests/test_basic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
import unittest
23

34
from pymysqlreplication.tests import base
45
from pymysqlreplication import BinLogStreamReader
@@ -542,6 +543,11 @@ def test_drop_table(self):
542543

543544

544545
class TestGtidBinLogStreamReader(base.PyMySQLReplicationTestCase):
546+
def setUp(self):
547+
super(TestGtidBinLogStreamReader, self).setUp()
548+
if not self.supportsGTID:
549+
raise unittest.SkipTest("database does not support GTID, skipping GTID tests")
550+
545551
def test_read_query_event(self):
546552
query = "CREATE TABLE test (id INT NOT NULL, data VARCHAR (50) NOT NULL, PRIMARY KEY (id))"
547553
self.execute(query)

0 commit comments

Comments
 (0)