PsiFile () { prepareTestDirectory(); VirtualFile sourceFile = null; for (String ext : new String[]{".py", ".pyx", ".pyi"}) { final String fileName = myTestFileName != null ? myTestFileName : getTestName(false) + ext; sourceFile = myFixture.findFileInTempDir(fileName); if (sourceFile != null) { break; } } Assert.assertNotNull("Could not find test file", sourceFile); return myFixture.getPsiManager().findFile(sourceFile); }