From ecb2cb9c226d510e79ad42e4d3e5a153d0c44ea5 Mon Sep 17 00:00:00 2001 From: starcat37 Date: Wed, 30 Aug 2023 12:38:06 +0900 Subject: [PATCH 1/5] docs: add typing in exceptions.py --- pymysqlreplication/exceptions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pymysqlreplication/exceptions.py b/pymysqlreplication/exceptions.py index 434d8d76..d233a6a6 100644 --- a/pymysqlreplication/exceptions.py +++ b/pymysqlreplication/exceptions.py @@ -1,19 +1,19 @@ class TableMetadataUnavailableError(Exception): - def __init__(self, table): + def __init__(self, table: str) -> None: Exception.__init__(self,"Unable to find metadata for table {0}".format(table)) class BinLogNotEnabled(Exception): - def __init__(self): + def __init__(self) -> None: Exception.__init__(self, "MySQL binary logging is not enabled.") class StatusVariableMismatch(Exception): - def __init__(self): - Exception.__init__(self, " ".join( + def __init__(self) -> None: + Exception.__init__(self, " ".join([ "Unknown status variable in query event." , "Possible parse failure in preceding fields" , "or outdated constants.STATUS_VAR_KEY" , "Refer to MySQL documentation/source code" , "or create an issue on GitHub" - )) + ])) From 20791e37645b083733dea96276d48c5ba567cae0 Mon Sep 17 00:00:00 2001 From: starcat37 Date: Wed, 30 Aug 2023 16:03:12 +0900 Subject: [PATCH 2/5] test: add missing DROP TABLE query --- pymysqlreplication/tests/test_basic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index cb27dada..4c0b43ff 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -771,7 +771,7 @@ def setUp(self): self.stream.close() ctl_db = copy.copy(self.database) ctl_db["db"] = None - ctl_db["port"] = int(os.environ.get("MYSQL_5_7_CTL_PORT") or 3307) + ctl_db["port"] = int(os.environ.get("MYSQL_5_7_CTL_PORT") or 3306) ctl_db["host"] = os.environ.get("MYSQL_5_7_CTL") or "localhost" self.ctl_conn_control = pymysql.connect(**ctl_db) self.ctl_conn_control.cursor().execute("DROP DATABASE IF EXISTS pymysqlreplication_test") @@ -794,6 +794,7 @@ def tearDown(self): def test_separate_ctl_settings_table_metadata_unavailable(self): self.execute("CREATE TABLE test (id INTEGER(11))") self.execute("INSERT INTO test VALUES (1)") + self.execute("DROP TABLE test;") self.execute("COMMIT") had_error = False From 5252bacd5c0cd8fe2f788865755486f3785d5545 Mon Sep 17 00:00:00 2001 From: starcat37 Date: Wed, 30 Aug 2023 16:06:56 +0900 Subject: [PATCH 3/5] typo: put the port back to 3307 --- pymysqlreplication/tests/test_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index 4c0b43ff..ed5c1aa6 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -771,7 +771,7 @@ def setUp(self): self.stream.close() ctl_db = copy.copy(self.database) ctl_db["db"] = None - ctl_db["port"] = int(os.environ.get("MYSQL_5_7_CTL_PORT") or 3306) + ctl_db["port"] = int(os.environ.get("MYSQL_5_7_CTL_PORT") or 3307) ctl_db["host"] = os.environ.get("MYSQL_5_7_CTL") or "localhost" self.ctl_conn_control = pymysql.connect(**ctl_db) self.ctl_conn_control.cursor().execute("DROP DATABASE IF EXISTS pymysqlreplication_test") From 749965434b548345ee9db7387e08b156a0b0a37b Mon Sep 17 00:00:00 2001 From: starcat37 Date: Wed, 30 Aug 2023 16:09:07 +0900 Subject: [PATCH 4/5] typo: remove unnecessary semi-colon --- pymysqlreplication/tests/test_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index ed5c1aa6..c7039a6f 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -794,7 +794,7 @@ def tearDown(self): def test_separate_ctl_settings_table_metadata_unavailable(self): self.execute("CREATE TABLE test (id INTEGER(11))") self.execute("INSERT INTO test VALUES (1)") - self.execute("DROP TABLE test;") + self.execute("DROP TABLE test") self.execute("COMMIT") had_error = False From 5b1afff34fba245faad450e940c187ae755d2a44 Mon Sep 17 00:00:00 2001 From: starcat37 Date: Thu, 31 Aug 2023 21:58:04 +0900 Subject: [PATCH 5/5] Fix: remove DROP TABLE query --- pymysqlreplication/tests/test_basic.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pymysqlreplication/tests/test_basic.py b/pymysqlreplication/tests/test_basic.py index c7039a6f..cb27dada 100644 --- a/pymysqlreplication/tests/test_basic.py +++ b/pymysqlreplication/tests/test_basic.py @@ -794,7 +794,6 @@ def tearDown(self): def test_separate_ctl_settings_table_metadata_unavailable(self): self.execute("CREATE TABLE test (id INTEGER(11))") self.execute("INSERT INTO test VALUES (1)") - self.execute("DROP TABLE test") self.execute("COMMIT") had_error = False