Closed psampathkumar closed 12 months ago
I think the engine is working fine, I am able to see the relevant lines of code in the webUI, the problem is somewhere in Pycharm
public class NavigateToTest {
public void Go(PycrunchTestMetadata testByFqn, PycrunchConnector _connector) {
VirtualFile fileByPath = LocalFileSystem.getInstance().findFileByPath(testByFqn.filename);
// PsiDocumentManagerImpl.getInstance(_connector._project).getPsiFile(fileByPath)
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(_connector._project);
Document document = FileDocumentManager.getInstance().getDocument(fileByPath);
PyFile psiFile = (PyFile) documentManager.getPsiFile(document);
String fqn = testByFqn.name;
int text_offset = 0;
boolean contains = fqn.contains("::");
if (contains) {
String[] split = fqn.split("::");
PyClass topLevelClass = psiFile.findTopLevelClass(split[0]);
if (topLevelClass != null) {
PyFunction test_method2 = topLevelClass.findMethodByName(split[1], false, null);
if (test_method2 != null) {
text_offset = test_method2.getTextOffset();
}
}
} else {
PsiElement psiElement = psiFile.findExportedName(fqn);
/*line 36 */ text_offset = psiElement.getTextOffset();
}
OpenFileDescriptor openFileDescriptor;
if (text_offset > 0) {
openFileDescriptor = new OpenFileDescriptor(_connector._project, fileByPath, text_offset);
}
else {
openFileDescriptor = new OpenFileDescriptor(_connector._project, fileByPath, 0, -1, true);
}
openFileDescriptor.navigate(true);
}
}
Here is the source file for pycharm plugin.
It looks like either Conda env is not supported entirely or you didn't select environment after opening the project. (By some reason Pycharm indexes doesn't work as expected)
I am not sure if it is a problem with conda. I am able to get the expected behaviour in the same enviroment, (infact even testing with some smaller functions in my project).
Please reopen if still actual and add more details, steps to reproduce
Pycrunch seems to work for me in small projects, in the same conda enviroment, but I am unable to use my existing tests along with pycrunch to find relevant lines of code.
These stacktraces might be helpful. Is there a way to run it in verbose mode or something to check what goes wrong ?
and