Skip to content

Commit d032edd

Browse files
committed
Make ServerTraceServices.start() plugins argument optional
#68 added a `plugins` keyword-only parameter to ServerTraceServices.start() but without a default value, making it required. This breaks every existing caller -- including this project's own tests/test_server.py::test_trace -- with: TypeError: ServerTraceServices.start() missing 1 required keyword-only argument: 'plugins' The method body already treats the argument as optional (`if plugins is not None:`) and its docstring documents it as FB6+ only, so restore the `= None` default. Adds a regression test asserting the parameter keeps a default of None.
1 parent 5e3c3c8 commit d032edd

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/firebird/driver/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5496,7 +5496,7 @@ def __action(self, action: ServerAction, label: str, session_id: int) -> str:
54965496
# response should contain the error message
54975497
raise DatabaseError(response)
54985498
return response
5499-
def start(self, *, config: str, name: str | None=None, plugins: str | list[str] | None) -> int:
5499+
def start(self, *, config: str, name: str | None=None, plugins: str | list[str] | None=None) -> int:
55005500
"""Start new trace session. **(ASYNC service)**
55015501
55025502
Arguments:

tests/test_server.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#
2323
# See LICENSE.TXT for details.
2424

25+
import inspect
2526
from io import BytesIO
2627
import pytest
2728
from packaging.specifiers import SpecifierSet
@@ -158,6 +159,19 @@ def test_get_limbo_transaction_ids(server_connection, db_file):
158159
ids = server_connection.database.get_limbo_transaction_ids(database=str(db_file))
159160
assert isinstance(ids, type(list()))
160161

162+
def test_trace_start_plugins_is_optional():
163+
"""Regression: ServerTraceServices.start() must keep `plugins` optional.
164+
165+
#68 added `plugins` as a keyword-only parameter but without a default,
166+
making it required and breaking every existing caller (including
167+
`test_trace` below, and any FB3/4/5 user) with
168+
"missing 1 required keyword-only argument: 'plugins'". The method body
169+
already treats it as optional (`if plugins is not None:`) and the
170+
docstring marks it FB6+ only, so it must default to None.
171+
"""
172+
sig = inspect.signature(driver.core.ServerTraceServices.start)
173+
assert sig.parameters['plugins'].default is None
174+
161175
def test_trace(server_connection, db_file, fb_vars):
162176
trace_config = """database = %s
163177
{

0 commit comments

Comments
 (0)