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.getPath(), false); final Sdk venvSdk = createTempSdk(venvSdkHome, SdkCreationType.EMPTY_SDK); assertNotNull(venvSdk); final PyPackageManager manager = PyPackageManager.getInstance(venvSdk); final List<PyPackage> packages1 = manager.refreshAndGetPackages(false); // TODO: Install Markdown from a local file manager.install(Arrays.asList(pyRequirement("Markdown", PyRequirementRelation.LTE, "3.3.3"), pyRequirement("httplib2")), Collections.emptyList()); final List<PyPackage> packages2 = manager.refreshAndGetPackages(false); final PyPackage markdown2 = findPackage("Markdown", packages2); assertNotNull(markdown2); assertTrue(markdown2.isInstalled()); final PyPackage pip1 = findPackage("pip", packages1); assertNotNull(pip1); assertEquals("pip", pip1.getName()); manager.uninstall(Collections.singletonList(pip1)); final List<PyPackage> packages3 = manager.refreshAndGetPackages(false); final PyPackage pip2 = findPackage("pip", packages3); assertNull(pip2); } catch (ExecutionException e) { throw new RuntimeException(String.format("Error for interpreter '%s': %s", sdk.getHomePath(), e.getMessage()), e); } catch (IOException e) { throw new RuntimeException(e); } } }); }