Skip to content

Commit e780ca9

Browse files
authored
Merge pull request #73 from fdcastel/fix-trace-start-plugins-default
Make ServerTraceServices.start() plugins argument optional (regression from #68)
2 parents 5e3c3c8 + d032edd commit e780ca9

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)