Skip to content

pylance loses link to a object if it was returned by fixture #5718

Description

@Akopov4

Environment data

  • Language Server version: 2024.4.1
  • OS and version: linux x64
  • Python version (and distribution if applicable, e.g. Anaconda): python3.8 , pip23.2.1,
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: basic

Code Snippet

class Cl_1:
    def __init__(self):
       pass
    def some_f1:(self):
       pass
   

class Cl_2:
    def __init__(self):
         self.obj1=Cl_1()
     
     def some_f2:(self):
       pass


  


@fixture
def fixt_1():    
    yield Cl_2()

@fixture
def fixt_2(fixt_1):     
     yield fixt_1

def test_some_test(fixt_2):
      fixt_2.some_f2()
      fixt_2.obj1.some_f1

Repro Steps

  1. XXX

Expected behavior

Test run ok. When I press CTRL+ left mouse click in any of the :
fixt_2.some_f2()
fixt_2.obj1.some_f1()

I jump into declaration of the appropriate function

Actual behavior

Test runs ok.
Inside my test:
(function) some_f2: Unknown
(function) obj1: Unknown

Logs

vscode_log.txt

XXX

Requirments

[requirements.txt](https://github.com/microsoft/pylance-release/files/14846468/requirements.txt)
XXX

Metadata

Metadata

Assignees

Labels

fixed in next version (main)A fix has been implemented and will appear in an upcoming versionrepro workspaceIssue has a retained repro workspace

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions