void () { PyCustomPackageIdentifier.EP_NAME.getPoint().registerExtension(new PyCustomPackageIdentifier() { @Override public boolean isPackage(PsiDirectory directory) { return true; } @Override public boolean isPackageFile(PsiFile file) { return false; } }, getTestRootDisposable()); PsiElement element = doResolve(); assertTrue(element instanceof PsiFile); assertEquals("myfile.py", ((PyFile)element).getName()); }