void () { runPythonTest(new PyPackagingTestTask() { @Override public void runTestOn(@NotNull String sdkHome, @Nullable Sdk existingSdk) throws Exception { final Sdk sdk = createTempSdk(sdkHome, SdkCreationType.EMPTY_SDK); try { final File tempDir = FileUtil.createTempDirectory(getTestName(false), null); final File venvDir = new File(tempDir, "venv"); final String venvSdkHome = PyPackageManager.getInstance(sdk).createVirtualEnv(venvDir.toString(), false); final Sdk venvSdk = createTempSdk(venvSdkHome, SdkCreationType.EMPTY_SDK); assertNotNull(venvSdk); assertTrue(PythonSdkUtil.isVirtualEnv(venvSdk)); assertInstanceOf(PythonSdkFlavor.getPlatformIndependentFlavor(venvSdk.getHomePath()), VirtualEnvSdkFlavor.class); final List<PyPackage> packages = PyPackageManager.getInstance(venvSdk).refreshAndGetPackages(false); final PyPackage setuptools = findPackage("setuptools", packages); assertNotNull(setuptools); assertEquals("setuptools", setuptools.getName()); final PyPackage pip = findPackage("pip", packages); assertNotNull(pip); assertEquals("pip", pip.getName()); } catch (IOException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(String.format("Error for interpreter '%s': %s", sdk.getHomePath(), e.getMessage()), e); } } }); }