Skip to content

Commit f357fe6

Browse files
Refactor test method in TestMariadbBinlogStreamReader class
1 parent e790196 commit f357fe6

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

docker-compose.yml

+13
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,16 @@ services:
1515
ports:
1616
- 3307:3307
1717
command: mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates -P 3307
18+
19+
mariadb-10.6:
20+
image: mariadb:10.6
21+
environment:
22+
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1
23+
ports:
24+
- "3308:3306"
25+
command: |
26+
--server-id=1
27+
--default-authentication-plugin=mysql_native_password
28+
--log-bin=master-bin
29+
--binlog-format=row
30+
--log-slave-updates=on

pymysqlreplication/tests/test_basic.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,16 @@ def test_parsing(self):
10051005
class TestMariadbBinlogStreaReader(base.PyMySQLReplicationTestCase):
10061006
def setUp(self):
10071007
super(TestMariadbBinlogStreaReader,self).setUp()
1008-
if not self.isMariaDB():
1009-
raise unittest.SkipTest("Skipping test: Not a MariaDB instance")
1008+
self.stream.close()
1009+
maria_db = copy.copy(self.database)
1010+
maria_db["db"] = None
1011+
maria_db["port"] = 3308
1012+
self.connect_conn_control(maria_db)
1013+
self.execute("DROP DATABASE IF EXISTS pymysqlreplication_test")
1014+
self.execute("CREATE DATABASE pymysqlreplication_test")
1015+
self.isMariaDB()
1016+
self.stream = BinLogStreamReader(maria_db, server_id=1024,
1017+
ignored_events=self.ignoredEvents())
10101018

10111019
def test_gtid_list_event(self):
10121020
event = self.stream.fetchone()

0 commit comments

Comments
 (0)