"Go to Declaration or Usages" unable to find a function definition in venv\Lib\site-packages\

Answered

On another computer installed with the same version of PyCharm, when right click argument "selenium" in function test_login below, and select "Go to Declaration and Usages", it directs to a function definition in file site-packages\pytest_selenium\pytest_selenium.py.

I expect the same behavior on my computer, but it didn't direct. Do the same for function definition in pytest_selenium.py, it is unable to find usages like test_login either.

It's PyCharm 2019.3.1, and have already configured scope to "All Places". Not sure if I missed anything in setting, or did I misunderstood something of the selenium here?

Any inputs will be highly appreciated.

 

Details of operation:

I was doing a "Go to Declaration and Usages" on:

def test_login(self, selenium, madi_ctx):
madi_ctx.setup_selenium(selenium)

, was expecting it directs to:

...\selenium-project\venv\Lib\site-packages\pytest_selenium\pytest_selenium.py

@pytest.fixture
def selenium(driver):
yield driver

 

0
2 comments

Make sure Settings/Preferences | Tools | Python Integrated Tools | Default test runner is set to pytest.

You may need to make some changes to your code (e.g., add a newline) for the change to take effect.

1
Avatar
Permanently deleted user

Thank you, Sergey Karpov . Your advice works.

Attribute "Default test runner" was silently set to "Unittests" as I created another "Run/Debug Configurations" before. And, yes, you're right, after changing it to "pytest",  I need to make a edit and save to let it take effect.

 

0

Please sign in to leave a comment.