Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should be possible to request other pytest fixtures from @pytest_lsp.fixture #71

Closed
alcarney opened this issue Aug 2, 2023 · 0 comments · Fixed by #75
Closed

It should be possible to request other pytest fixtures from @pytest_lsp.fixture #71

alcarney opened this issue Aug 2, 2023 · 0 comments · Fixed by #75
Labels
enhancement New feature or request pytest-lsp Issues affecting the pytest-lsp package

Comments

@alcarney
Copy link
Member

alcarney commented Aug 2, 2023

Consider the following fixture definition

@pytest_lsp.fixture(
    scope="session",
    params=["visual_studio_code", "neovim"],
    config=ClientServerConfig(
        server_command=[sys.executable, *SERVER_CMD],
    ),
)
async def client(request, uri_for, lsp_client: LanguageClient):
    workspace = uri_for("sphinx-default", "workspace")

    await lsp_client.initialize_session(
        types.InitializeParams(
            capabilities=client_capabilities(request.param),
            workspace_folders=[
                types.WorkspaceFolder(uri=str(workspace), name="sphinx-default"),
            ],
        )
    )

    yield

    # Teardown
    await lsp_client.shutdown_session()

Which results in the following error

    @pytest_asyncio.fixture(**kwargs)
    async def the_fixture(request):
        client_server = make_client_server(config)
        await client_server.start()
    
        kwargs = get_fixture_arguments(fn, client_server.client, request)
>       result = fn(**kwargs)
E       TypeError: client() missing 1 required positional argument: 'uri_for'

@alcarney alcarney added enhancement New feature or request pytest-lsp Issues affecting the pytest-lsp package labels Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pytest-lsp Issues affecting the pytest-lsp package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant