Skip to content

Commit 28643ff

Browse files
committed
Support sending ALS settings as initializationOptions in tests
1 parent 03317e7 commit 28643ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

testsuite/drivers/pylsp.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ def test(
593593
initialize: bool = True,
594594
shutdown: bool = True,
595595
assert_no_lsp_errors: bool = True,
596+
als_settings: ALSSettings | None = None,
596597
) -> Callable:
597598
"""A decorator to mark a function as a test entry point. The function must receive a
598599
single parameter of type LanguageClient.
@@ -620,6 +621,8 @@ def test(
620621
of the test function.
621622
:param assert_no_lsp_errors: automatically assert that no LSP log message of level
622623
error were received after the end of the test function.
624+
:param als_settings: ALS settings to send as 'initializationOptions' with the
625+
'initialize' request. Only applicable if initialize=True (which is the default).
623626
"""
624627

625628
async def async_wrapper(
@@ -644,6 +647,9 @@ async def async_wrapper(
644647
# ALS doesn't support the newer workspaceFolders property so we
645648
# have to use the older rootURI property.
646649
root_uri=URI(os.getcwd()),
650+
initialization_options=(
651+
{"ada": als_settings} if als_settings is not None else None
652+
),
647653
)
648654
)
649655

0 commit comments

Comments
 (0)