Skip to content

Commit 149e5eb

Browse files
committed
Added fix for unittest launch and linter issues in the release branch
This patch fixes the issue where bootstrapped mysql-9.3.0 server is trying to initialize to run the unittests by setting a value for the non-existent server variable `innodb_log_file_size`. Also, typing and linter issues are resolved. Change-Id: I39266fa3516958a6e875022bfca80e39d0f64b43
1 parent 521cef7 commit 149e5eb

File tree

13 files changed

+42
-29
lines changed

13 files changed

+42
-29
lines changed

mysql-connector-python/lib/mysql/connector/aio/plugins/authentication_webauthn_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2023, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -195,7 +195,7 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> Optional[bytes]:
195195
if device is not None:
196196
logger.debug("WebAuthn - Use USB HID channel")
197197
elif CTAP_PCSC_DEVICE_AVAILABLE:
198-
device = next(CtapPcscDevice.list_devices(), None)
198+
device = next(CtapPcscDevice.list_devices(), None) # type: ignore[arg-type]
199199

200200
if device is None:
201201
raise errors.InterfaceError("No FIDO device found")

mysql-connector-python/lib/mysql/connector/conversion.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -26,8 +26,7 @@
2626
# along with this program; if not, write to the Free Software Foundation, Inc.,
2727
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2828

29-
"""Converting MySQL and Python types
30-
"""
29+
"""Converting MySQL and Python types"""
3130

3231
import array
3332
import datetime

mysql-connector-python/lib/mysql/connector/cursor_cext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
ParamsSequenceType,
6262
RowItemType,
6363
RowType,
64-
StrOrBytes,
64+
StrOrBytesAny,
6565
WarningType,
6666
)
6767

@@ -1090,7 +1090,7 @@ def reset(self, free: bool = True) -> None:
10901090

10911091
def execute(
10921092
self,
1093-
operation: StrOrBytes,
1093+
operation: StrOrBytesAny,
10941094
params: Optional[ParamsSequenceOrDictType] = None,
10951095
map_results: bool = False,
10961096
) -> None:

mysql-connector-python/lib/mysql/connector/django/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __init__(self, cursor: "MySQLCursorAbstract") -> None:
143143

144144
@staticmethod
145145
def _adapt_execute_args_dict(
146-
args: Dict[str, MySQLConvertibleType]
146+
args: Dict[str, MySQLConvertibleType],
147147
) -> Dict[str, MySQLConvertibleType]:
148148
if not args:
149149
return args

mysql-connector-python/lib/mysql/connector/plugins/authentication_webauthn_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2023, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -194,7 +194,7 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> Optional[bytes]:
194194
if device is not None:
195195
logger.debug("WebAuthn - Use USB HID channel")
196196
elif CTAP_PCSC_DEVICE_AVAILABLE:
197-
device = next(CtapPcscDevice.list_devices(), None)
197+
device = next(CtapPcscDevice.list_devices(), None) # type: ignore[arg-type]
198198

199199
if device is None:
200200
raise errors.InterfaceError("No FIDO device found")

mysql-connector-python/lib/mysql/connector/types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2023, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -36,6 +36,7 @@
3636
from time import struct_time
3737
from typing import (
3838
TYPE_CHECKING,
39+
Any,
3940
Deque,
4041
Dict,
4142
List,
@@ -62,6 +63,9 @@ class MySQLScriptPartition(TypedDict):
6263
StrOrBytes = Union[str, bytes]
6364
"""Shortcut to for `String or Bytes`."""
6465

66+
StrOrBytesAny = Union[StrOrBytes, Any]
67+
"""Shortcut to for `String or Bytes or Any`."""
68+
6569
StrOrBytesPath = Union[StrOrBytes, os.PathLike]
6670
"""Shortcut to for `String or Bytes or os.PathLike` - this shortcut
6771
may come in handy as a hint for path-like variables."""

mysql-connector-python/tests/mysqld.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -458,7 +458,6 @@ def _get_bootstrap_cmd(self):
458458
"--default-storage-engine=myisam",
459459
"--net_buffer_length=16K",
460460
"--tmpdir=%s" % self._tmpdir,
461-
"--innodb_log_file_size=1Gb",
462461
]
463462

464463
if self._version[0:2] >= (8, 0) or self._version >= (5, 7, 21):
@@ -468,6 +467,7 @@ def _get_bootstrap_cmd(self):
468467
cmd.append("--bootstrap")
469468

470469
if self._version < (8, 0, 3):
470+
cmd.append("--innodb_log_file_size=1Gb")
471471
cmd.append("--log-warnings=0")
472472

473473
if self._version[0:2] < (5, 5):

mysql-connector-python/unittests.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# Copyright (c) 2009, 2024, Oracle and/or its affiliates.
4+
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License, version 2.0, as
@@ -149,7 +149,6 @@ def filter(self, record: logging.LogRecord):
149149
log-bin = mysqld_{name}_bin
150150
local_infile = 1
151151
innodb_flush_log_at_trx_commit = 2
152-
innodb_log_file_size = 1Gb
153152
general_log_file = general_{name}.log
154153
{secure_file_priv}
155154
"""
@@ -741,7 +740,13 @@ def init_mysql_server(port, options):
741740
"::" if tests.IPV6_AVAILABLE else "0.0.0.0"
742741
)
743742
},
744-
}
743+
},
744+
{
745+
"version": (8, 0, 30),
746+
"options": {
747+
"innodb_log_file_size": "1Gb",
748+
},
749+
},
745750
]
746751

747752
if options.secure_file_priv is not None:

mysqlx-connector-python/lib/mysqlx/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2016, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -1785,7 +1785,7 @@ def _get_pools(self, settings: Dict[str, Any]) -> List:
17851785

17861786
@staticmethod
17871787
def _get_connections_settings(
1788-
settings: Dict[str, Any]
1788+
settings: Dict[str, Any],
17891789
) -> List[Tuple[str, Dict[str, Any]]]:
17901790
"""Generates a list of separated connection settings for each host.
17911791

mysqlx-connector-python/lib/mysqlx/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2016, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -1032,7 +1032,7 @@ def build_execute_statement(
10321032

10331033
@staticmethod
10341034
def build_insert(
1035-
stmt: Union[AddStatement, InsertStatement]
1035+
stmt: Union[AddStatement, InsertStatement],
10361036
) -> Tuple[str, MessageType]:
10371037
"""Build insert statement.
10381038

mysqlx-connector-python/lib/mysqlx/result.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2016, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2016, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -83,7 +83,7 @@ def varint_from_protobuf_stream(payload: bytes) -> Tuple[int, bytes]:
8383
shift = 0
8484

8585
for item in payload:
86-
char = item if isinstance(item, int) else ord(item) # type: ignore[arg-type]
86+
char = item if isinstance(item, int) else ord(item)
8787
eos = (char & 0x80) == 0
8888
cur_bits = char & 0x7F
8989
cur_bits <<= shift
@@ -144,11 +144,11 @@ def set_from_protobuf(payload: bytes) -> List[bytes]:
144144
def decimal_from_protobuf(payload: bytes) -> decimal.Decimal:
145145
digits = []
146146
sign = None
147-
scale = payload[0] if isinstance(payload[0], int) else ord(payload[0]) # type: ignore[arg-type]
147+
scale = payload[0] if isinstance(payload[0], int) else ord(payload[0])
148148
payload = payload[1:]
149149

150150
for item in payload:
151-
char = item if isinstance(item, int) else ord(item) # type: ignore[arg-type]
151+
char = item if isinstance(item, int) else ord(item)
152152
high_bcd = (char & 0xF0) >> 4
153153
low_bcd = char & 0x0F
154154
if high_bcd < 0x0A:

mysqlx-connector-python/tests/mysqld.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0, as
@@ -458,7 +458,6 @@ def _get_bootstrap_cmd(self):
458458
"--default-storage-engine=myisam",
459459
"--net_buffer_length=16K",
460460
"--tmpdir=%s" % self._tmpdir,
461-
"--innodb_log_file_size=1Gb",
462461
]
463462

464463
if self._version[0:2] >= (8, 0) or self._version >= (5, 7, 21):
@@ -468,6 +467,7 @@ def _get_bootstrap_cmd(self):
468467
cmd.append("--bootstrap")
469468

470469
if self._version < (8, 0, 3):
470+
cmd.append("--innodb_log_file_size=1Gb")
471471
cmd.append("--log-warnings=0")
472472

473473
if self._version[0:2] < (5, 5):

mysqlx-connector-python/unittests.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# Copyright (c) 2009, 2024, Oracle and/or its affiliates.
4+
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License, version 2.0, as
@@ -134,7 +134,6 @@
134134
log-bin = mysqld_{name}_bin
135135
local_infile = 1
136136
innodb_flush_log_at_trx_commit = 2
137-
innodb_log_file_size = 1Gb
138137
general_log_file = general_{name}.log
139138
{secure_file_priv}
140139
"""
@@ -468,7 +467,13 @@ def init_mysql_server(port, options):
468467
"::" if tests.IPV6_AVAILABLE else "0.0.0.0"
469468
)
470469
},
471-
}
470+
},
471+
{
472+
"version": (8, 0, 30),
473+
"options": {
474+
"innodb_log_file_size": "1Gb",
475+
},
476+
},
472477
]
473478

474479
if options.secure_file_priv is not None:

0 commit comments

Comments
 (0)