From ab5ce52f58ee143efa47dc63c7d604535881cfff Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Wed, 15 Mar 2017 22:44:14 +0300 Subject: [PATCH] Allow search for Python stubs for third-party libraries in tests --- .../src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt b/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt index ed3f86b4f8b5..948f9e71b7c0 100644 --- a/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt +++ b/python/src/com/jetbrains/python/codeInsight/typing/PyTypeShed.kt @@ -15,6 +15,7 @@ */ package com.jetbrains.python.codeInsight.typing +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.PathManager import com.intellij.openapi.projectRoots.Sdk import com.intellij.openapi.vfs.StandardFileSystems @@ -58,6 +59,9 @@ object PyTypeShed { return true } if (isInThirdPartyLibraries(root)) { + if (ApplicationManager.getApplication().isUnitTestMode) { + return true + } val pyPIPackage = PyPIPackageUtil.PACKAGES_TOPLEVEL[topLevelPackage] ?: topLevelPackage val packages = PyPackageManagers.getInstance().forSdk(sdk).packages ?: return true return PyPackageUtil.findPackage(packages, pyPIPackage) != null