decoded = jwt.decode(token, "PyCharmCommunity")
I am writing a PyCharm plugin where I am trying to get to the declaration of the invocation jwt.decode(token, "PyCharmCommunity") in the above snippet. The following snippet works fine if the plugin is run using Gradle runIDE task(implementing the appStarter extension point).
TypeEvalContext typeEvalContext = TypeEvalContext.codeCompletion(getProject(), psiFile);
PyResolveContext resolveContext = PyResolveContext.defaultContext(typeEvalContext);
List<PyCallable> resolveFunctions = callExpression.multiResolveCalleeFunction(resolveContext);
I configured Python SDK for the loaded project to get this snippet working. The SDK is pointed to essentially a python virtual environment where all the relevant packages are installed. The above snippet resolves to the actual declaration of jwt.decode in the virtual environment, which is something like,
Now, I was also trying to write test cases for this snippet. I've set up a test environment where CodeInsightTestFixture is used for setting up project and SDK and loading the python test file. However, in the test environment, when the above snippet is invoked, the resolvedFunction is not the same. It now resolves to a file like the following,
Am I missing something here in the test environment that limits the functionality of the multiResolve API?
The plugin has been set up using gradle-intellij-plugin template and for Pycharm Community. The test environment uses Junit3 and the test cases extend com.intellij.testFramework.UsefulTestCase. The SDK path is same for both of the mentioned cases.