Add navigation to pytest fixtures #2576
Replies: 4 comments 3 replies
-
Will just say that on even medium-sized test suites, with fixtures spread out across various files, this can become a real pain. Would be fantastic to see this implemented! |
Beta Was this translation helpful? Give feedback.
-
Some existing extensions for reference: |
Beta Was this translation helpful? Give feedback.
-
Having IntelliSense support for this would be nice if navigation is also on the table. I started a discussion about getting completion for pytest fixtures in But, I think that was the wrong place to launch this discussion. @brettcannon referred me here, which makes sense. If the Pylance extension is not open source, is there at least a recommended mechanism outside folks could tinker with to start hacking together a reference implementation for fixture support aside from creating a standalone extension? Or would providing IntelliSense + code navigation via an extension be useful? The extensions linked above can serve as a reference but they are not what I would think would be "production grade" in the sense that they don't consider/support workspace features like |
Beta Was this translation helpful? Give feedback.
-
On the landing page of one of the extensions linked in a previous comment, it says that "As of Visual Studio Code version 1.76, Pylance natively supports pytest fixture detection", but it doesn't seem to work for me. "Go to definition" just highlights the parameter, not the fixture. Anyone else? |
Beta Was this translation helpful? Give feedback.
-
When using pytest, tests can use fixtures that allow mocked objects or functions to be easily reused in tests. They look like parameters, but through some Pytest magic, they are invoked and passed into the test function.
My feature request is that Cmd+clicking on the parameter of a test function takes me to file or definition where the fixture is defined.
Cmd+clicking on the
fixture_1
parameter should take me to:Reference: https://docs.pytest.org/en/6.2.x/fixture.html
Beta Was this translation helpful? Give feedback.
All reactions