void () { myFixture.copyDirectoryToProject(getTestName(true), ""); PsiManager psiManager = myFixture.getPsiManager(); PsiFile sameDirResolveOrigin = psiManager.findFile(myFixture.findFileInTempDir("dir/main.py")); PyQualifiedNameResolveContext sameDirContext = PyResolveImportUtil.fromFoothold(sameDirResolveOrigin).copyWithRelative(0); List<PsiElement> sameDirResults = PyResolveImportUtil.resolveQualifiedName(QualifiedName.fromDottedString("os"), sameDirContext); PsiElement sameDirOnlyResult = assertOneElement(sameDirResults); PsiFileSystemItem sameDirOsModule = assertInstanceOf(sameDirOnlyResult, PsiFileSystemItem.class); assertEquals(myFixture.findFileInTempDir("dir/os.py"), sameDirOsModule.getVirtualFile()); assertTrue(psiManager.isInProject(sameDirOsModule)); PsiFile absResolveOrigin = psiManager.findFile(myFixture.findFileInTempDir("main.py")); PyQualifiedNameResolveContext absContext = PyResolveImportUtil.fromFoothold(absResolveOrigin).copyWithRelative(0); List<PsiElement> absResults = PyResolveImportUtil.resolveQualifiedName(QualifiedName.fromDottedString("os"), absContext); PsiElement absOnlyResult = assertOneElement(absResults); PsiFileSystemItem stdlibOsModule = assertInstanceOf(absOnlyResult, PsiFileSystemItem.class); assertNotEquals(myFixture.findFileInTempDir("dir/os.py"), stdlibOsModule.getVirtualFile()); assertFalse(psiManager.isInProject(stdlibOsModule)); }