Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Support for Go to Definition on pytest fixtures when using indirect parametrize #5955

Closed
a-kachurin opened this issue Jun 1, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@a-kachurin
Copy link

a-kachurin commented Jun 1, 2024

Environment data

2024-06-01 04:28:52.343 [info] (Client) Pylance async client (2024.5.1) started with python extension (2024.6.0)
2024-06-01 04:28:53.051 [info] [Info - 4:28:53 AM] (12564) Pylance language server 2024.5.1 (pyright version 1.1.360, commit 4bc8428d) starting
2024-06-01 04:28:53.059 [info] [Info - 4:28:53 AM] (12564) Server root directory: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist
2024-06-01 04:28:53.061 [info] [Info - 4:28:53 AM] (12564) Starting service instance "test"
2024-06-01 04:28:53.062 [info] [Info - 4:28:53 AM] (12564) Auto-Indent enabled
2024-06-01 04:28:53.063 [info] [Info - 4:28:53 AM] (12564) Auto format for strings enabled
2024-06-01 04:28:53.068 [info] [Info - 4:28:53 AM] (12564) Background analysis(1) root directory: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist
2024-06-01 04:28:53.068 [info] [Info - 4:28:53 AM] (12564) Background analysis(1) started
2024-06-01 04:28:53.084 [info] [Info - 4:28:53 AM] (12564) Setting pythonPath for service "test": "C:\Program Files\Python312\python.exe"
2024-06-01 04:28:53.085 [info] [Info - 4:28:53 AM] (12564) Setting environmentName for service "test": "3.12.3 (global)"
2024-06-01 04:28:53.112 [info] [Info - 4:28:53 AM] (12564) Assuming Python version 3.12.3.final.0
2024-06-01 04:28:53.191 [info] [Info - 4:28:53 AM] (12564) Found 1 source file
2024-06-01 04:28:53.633 [info] [Info - 4:28:53 AM] (12564) Indexer background runner(2) root directory: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist (index)
2024-06-01 04:28:53.633 [info] [Info - 4:28:53 AM] (12564) Indexing(2) started
2024-06-01 04:28:53.715 [info] [Info - 4:28:53 AM] (12564) scanned(2) 197 files over 1 exec env
2024-06-01 04:28:53.812 [info] [Info - 4:28:53 AM] (12564) indexed(2) 150 files over 1 exec env
2024-06-01 04:28:53.834 [info] [Info - 4:28:53 AM] (12564) Indexing finished(2).

Code Snippet

import pytest


@pytest.fixture()
def my_fixture(request):
    print(request.param)


@pytest.mark.parametrize('my_fixture', [1, 2], indirect=True)
def test_example(my_fixture):
    pass

Repro Steps

  1. Ctrl + Left Mouse Button (LMB) on the fixture in the function's variables (def test_example(my_fixture):)

Expected behavior

Navigated to the function definition (def my_fixture(request):)

Actual behavior

Jumped to the string in parametrize (@pytest.mark.parametrize('my_fixture', [1, 2], indirect=True))

Logs

2024-06-01 04:38:01.623 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.623 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.623 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py (0ms)
2024-06-01 04:38:01.624 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.624 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.624 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py (0ms)
2024-06-01 04:38:01.772 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (4ms)
2024-06-01 04:38:01.780 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (8ms)
2024-06-01 04:38:01.784 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi (4ms)
2024-06-01 04:38:01.787 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi (3ms)
2024-06-01 04:38:01.831 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.831 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.832 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py (0ms)
2024-06-01 04:38:01.832 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.832 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:01.832 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py (0ms)
2024-06-01 04:38:02.891 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (3ms)
2024-06-01 04:38:02.899 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (7ms)
2024-06-01 04:38:02.902 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi (3ms)
2024-06-01 04:38:02.903 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi (1ms)
2024-06-01 04:38:03.089 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.089 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.089 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py (0ms)
2024-06-01 04:38:03.089 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.089 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.090 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py (1ms)
2024-06-01 04:38:03.251 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (2ms)
2024-06-01 04:38:03.256 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (6ms)
2024-06-01 04:38:03.261 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi (4ms)
2024-06-01 04:38:03.262 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi (1ms)
2024-06-01 04:38:03.307 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.307 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.308 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py (1ms)
2024-06-01 04:38:03.308 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.308 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py_chained___skip__completion__.py (0ms)
2024-06-01 04:38:03.308 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/Documents/test/test_example.py (0ms)
2024-06-01 04:38:03.350 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 0ms] (2ms)
2024-06-01 04:38:03.355 [info] (6696) [FG] parsing: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (5ms)
2024-06-01 04:38:03.359 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/builtins.pyi (4ms)
2024-06-01 04:38:03.360 [info] (6696) [FG] binding: file:///c%3A/Users/Alex/.vscode/extensions/ms-python.vscode-pylance-2024.5.1/dist/typeshed-fallback/stdlib/typing.pyi (1ms)

image

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jun 1, 2024
@heejaechang
Copy link
Contributor

currently we don't support indirect=True case. so, if we add support for it, it would be enhancement request.

@a-kachurin
Copy link
Author

Please, can you add it? Should I edit the ticket?

@judej judej added bug Something isn't working and removed needs repro Issue has not been reproduced yet labels Jun 4, 2024
@judej judej changed the title Go to Definition fails for pytest fixtures when using parametrize Support for Go to Definition on pytest fixtures when using indirect parametrize Jun 4, 2024
@judej
Copy link
Contributor

judej commented Jul 11, 2024

Moving this issue to discussion as an enhancement request for comments and upvotes.

@microsoft microsoft locked and limited conversation to collaborators Jul 11, 2024
@judej judej converted this issue into discussion #6118 Jul 11, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants