Skip to content

Commit de228fc

Browse files
mjs1995heehehe
authored andcommitted
feat: add logging for dbms and github actions for test
1 parent cb0a486 commit de228fc

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.github/workflows/pytest.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,13 @@ jobs:
4646
pip install pytest
4747
4848
- name: Run test suite
49+
working-directory: pymysqlreplication/tests
4950
run: |
50-
pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos and not test_query_event_latin1"
51+
dbms_versions=("mysql-5" "mysql-8")
52+
for version in "${dbms_versions[@]}"; do
53+
pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos and not test_query_event_latin1" --dbms=$version
54+
done
55+
56+
- name: Run tests for MariaDB
57+
run: |
58+
pytest -m mariadb -k "not test_no_trailing_rotate_event and not test_end_log_pos and not test_query_event_latin1"

pymysqlreplication/tests/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def get_databases():
1717
return databases
1818

1919

20-
databases = get_databases()
2120
base = unittest.TestCase
2221

2322

@@ -27,6 +26,9 @@ def ignoredEvents(self):
2726

2827
@pytest.fixture(autouse=True)
2928
def setUpDBMS(self, get_dbms):
29+
databases = get_databases()
30+
# For local testing, set the get_dbms parameter to one of the following values: 'mysql-5', 'mysql-8', mariadb-10'.
31+
# This value should correspond to the desired database configuration specified in the 'config.json' file.
3032
self.database = databases[get_dbms]
3133
"""
3234
self.database = {

pymysqlreplication/tests/test_basic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pymysqlreplication.row_event import *
1111
from pymysqlreplication.packet import BinLogPacketWrapper
1212
from pymysql.protocol import MysqlPacket
13+
import pytest
1314

1415
__all__ = [
1516
"TestBasicBinLogStreamReader",
@@ -1299,6 +1300,7 @@ def tearDown(self):
12991300
super(TestStatementConnectionSetting, self).tearDown()
13001301

13011302

1303+
@pytest.mark.mariadb
13021304
class TestMariadbBinlogStreamReader(base.PyMySQLReplicationTestCase):
13031305
def setUp(self):
13041306
super().setUp()
@@ -1335,6 +1337,7 @@ def test_binlog_checkpoint_event(self):
13351337
self.assertEqual(event.filename, self.bin_log_basename() + ".000001")
13361338

13371339

1340+
@pytest.mark.mariadb
13381341
class TestMariadbBinlogStreamReader2(base.PyMySQLReplicationTestCase):
13391342
def setUp(self):
13401343
super().setUp()
@@ -1485,6 +1488,7 @@ def test_query_event_latin1(self):
14851488
assert event.query == r"CREATE TABLE test_latin1_\xd6\xc6\xdb (a INT)"
14861489

14871490

1491+
@pytest.mark.mariadb
14881492
class TestOptionalMetaData(base.PyMySQLReplicationTestCase):
14891493
def setUp(self):
14901494
super(TestOptionalMetaData, self).setUp()

0 commit comments

Comments
 (0)