Go to Definition for pytest fixture jumps to usage instead of fixture definition in Cursor (works in VS Code)

Describe the Bug

Looks like pytest fixture symbol resolution is treated as a local parameter in Cursor, whereas VS Code correctly resolves to the fixture function.

Steps to Reproduce

  1. Create fresh repo
  2. Create python venv
  3. Install pytest
  4. Create test_example.py in tests directory of repo with content
import pytest

@pytest.fixture
def sample_fixture():
    return 1

def test_sample(sample_fixture):
    assert sample_fixture == 1
  1. Place the caret on sample_fixture in def test_sample(sample_fixture):.
  2. Trigger “Go to Definition”
  3. Navigation targets the parameter usage/annotation; the caret stays within test_sample

Expected Behavior

Navigate to the fixture function definition @pytest.fixture def sample_fixture():.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.4.2 (Universal)
VSCode Version: 1.99.3
Commit: 07aa3b4519da4feab4761c58da3eeedd253a1670
Date: 2025-08-06T19:23:39.081Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.5.0

Additional Information

In the latest VS Code (version 1.103.0, Python ext 2025.12.0, Pylance 2025.7.1) the same action correctly jumps to the fixture definition.

Does this stop you from using Cursor

No - Cursor works, but with this issue

2 Likes

Hi @matveirush, can you create a feature request for this in the basedpyright GitHub? Once their extension supports this feature, we’ll merge it into our extension.

Thank you for your response @ravirahman . I’d respectfully ask that your team create the issue in basedpyright directly, for the following reasons:

1. I don’t understand how the Cursor Python extension integrates with basedpyright to implement “Go to Definition” functionality, which limits my ability to provide comprehensive technical details. While I can describe what I see as a user, your team has the technical expertise to provide the precise specifications for how pytest fixture resolution should be implemented.

2. I feel it might be more natural for the Cursor team to engage directly with basedpyright maintainers about features needed for your Python extension. As an end user, I’d be in the position of asking open-source maintainers to implement functionality for a commercial product that I neither develop nor maintain, which feels a bit awkward from my perspective. I think direct communication between the teams would be more straightforward.

I completely understand that your resources are limited, but so are basedpyright’s maintainers. Perhaps you could discuss this issue together and decide who should implement it (or if it’s reasonable to implement at all).

I realize this is no longer a bug report but rather a feature request, so I would understand if it takes time to implement or isn’t implemented at all. That said, I would be happy to have such a feature.

Hi, I am not sure what has changed but today my cursor setup decided not have this feature any more despite having it for at least a month now. what could have changed?
Also my fixture wrapper color started becoming yellow instead of green.

image

I don’t know who this is relates to but it sounds to me like it’s related to here. so i am attaching this video of a bug.

What are we seeing in the video?

  1. Normal cursor usage, I have been working on python tests using pytest and fixtures of a while now and you could have always jumped to the definition reference by ctrl+click the fixture name on the test, demonstrated working
  2. after window reload it stops working and shows in-file references mostly
  3. after disabling the python extension, reloading (important) and enabling it again the ctrl+click and colors return to normal operation
    https://drive.google.com/file/d/1dJtprhRlZedI8n_mo21JgfHcKFJApEBS/view?usp=sharing

Surprising mandatory pylance uninstall - Bug Reports - Cursor - Community Forum

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.