Open Evan0000000000 opened 7 months ago
Thanks for the issue.
For the best experience I recommend adding type annotation mocker: MockerFixture
like in the pytest docs here https://pypi.org/project/pytest-mock/3.7.0/
from pytest_mock import MockerFixture
def test_foo(mocker: MockerFixture) -> None:
...
there might be a issue related to fixtures that return a generator that we fail to provide autocompletions for.
not sure on top of my head why this could be happening. we might be failed to create types to inject for fixture completion. or failed to inject correct import statements for fixtures.
starting point to investigate should be here - https://github.com/microsoft/pyrx/blob/main/packages/pylance-internal/src/pytest/pyTestDocumentTransformer.ts#L103
related to https://github.com/microsoft/pylance-release/issues/5718
fixture using yield
Hello, is there any movement in this investigation?
Discussed in #5510 , I don't seem to have the ability to reopen that ticket so I opted to create a new one. As mentioned there it seems as if this should be working as of #4590 but I'm seeing different behavior:
I'm unclear if something about pytest-mock might be causing this not to work correctly or if #4590 doesn't actually apply to this situation, or if it's something else, but I'd like to come to a conclusion one way or another.
Environment data
Code Snippet
Expected behavior
Hovering over the fixture within the test case signature and the test case code should type it correctly and autocomplete should work
Actual behavior
Hovering over the fixture in the test case signature types it correctly, but not in the test case code. Autocomplete does not work
Logs
The paths involved with the trace logs reveal some information about my employer and aspects of the code I work on I'd need to spend some time redacting. Can provide these but I'd rather not take the time if it's not required for this issue.