mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-28016 Investigating why the respective test blinks on TC
Added additional info in assertions and also replaced the original cache data in JSON with a stub containing only Flask required for the test (otherwise, its initialization seems to slow execution down dramatically).
This commit is contained in:
@@ -8,6 +8,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -110,6 +111,12 @@ public abstract class PyAbstractPackageCache {
|
||||
return packageInfo != null ? packageInfo.getVersions() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s(size=%d): %s...", getClass().getSimpleName(), myPackages.size(),
|
||||
StreamEx.ofKeys(myPackages).limit(5).joining(", "));
|
||||
}
|
||||
|
||||
protected static class PackageInfo {
|
||||
public static final PackageInfo EMPTY = new PackageInfo();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.jetbrains.python.packaging;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
@@ -36,6 +37,11 @@ public class PyPIPackageCache extends PyAbstractPackageCache {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
static synchronized void reset() {
|
||||
ourInstance = null;
|
||||
}
|
||||
|
||||
private PyPIPackageCache() {
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -16,8 +16,18 @@ public class PyPackageCacheTest extends PyTestCase {
|
||||
public void testCaseInsensitivePackageNameMatching() {
|
||||
final PyPIPackageCache cache = PyPIPackageCache.getInstance(Paths.get(getTestDataPath(), "pypi-cache.json"));
|
||||
|
||||
assertTrue(cache.containsPackage("flask"));
|
||||
assertTrue(cache.containsPackage("Flask"));
|
||||
assertTrue("Package name in original case is missing: " + cache.toString(), cache.containsPackage("Flask"));
|
||||
assertTrue("Package name in altered case is missing: " + cache.toString(), cache.containsPackage("flask"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
PyPIPackageCache.reset();
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user