Skip to content

Commit 56834a6

Browse files
alirana01sigmaaa
andauthored
bug fix after rebase (#1342)
* bug fix after rebase * fix: fix unit failing unit test --------- Co-authored-by: Denys Almazov <[email protected]>
1 parent f565735 commit 56834a6

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

bundles/com.espressif.idf.core/src/com/espressif/idf/core/bug/BugReportGenerator.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,6 @@ private File getInstalledToolsInfoFile() throws IOException
323323
Logger.log(environment.toString());
324324
environment.put("PYTHONUNBUFFERED", "1"); //$NON-NLS-1$ //$NON-NLS-2$
325325

326-
environment.put("IDF_GITHUB_ASSETS", //$NON-NLS-1$
327-
Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
328-
IDFCorePreferenceConstants.IDF_GITHUB_ASSETS,
329-
IDFCorePreferenceConstants.IDF_GITHUB_ASSETS_DEFAULT_GLOBAL, null));
330-
331-
environment.put("PIP_EXTRA_INDEX_URL", //$NON-NLS-1$
332-
Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
333-
IDFCorePreferenceConstants.PIP_EXTRA_INDEX_URL,
334-
IDFCorePreferenceConstants.PIP_EXTRA_INDEX_URL_DEFAULT_GLOBAL, null));
335-
336326
if (StringUtil.isEmpty(gitExecutablePath))
337327
{
338328
Logger.log("Git executable path is empty. Please check GIT_PATH environment variable."); //$NON-NLS-1$

bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,6 @@ public static Map<String, String> getSystemEnv()
909909
{
910910
Map<String, String> env = new HashMap<>(System.getenv());
911911

912-
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
913-
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
914-
env.put(IDFCorePreferenceConstants.IDF_TOOLS_PATH, idfToolsPath);
915-
916912
// Merge Homebrew bin paths into PATH
917913
// Windows may use "Path" while Unix uses "PATH"
918914
String keyPath = env.containsKey("PATH") ? "PATH" : "Path"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -935,14 +931,6 @@ public static Map<String, String> getSystemEnv()
935931

936932
return env;
937933
}
938-
939-
public static String getIDFToolsPathFromPreferences()
940-
{
941-
String idfToolsPath = Platform.getPreferencesService().getString(IDFCorePlugin.PLUGIN_ID,
942-
IDFCorePreferenceConstants.IDF_TOOLS_PATH, IDFCorePreferenceConstants.IDF_TOOLS_PATH_DEFAULT, null);
943-
return idfToolsPath;
944-
}
945-
946934

947935
public static void closeWelcomePage(IWorkbenchWindow activeww)
948936
{

tests/com.espressif.idf.core.test/src/com/espressif/idf/core/util/test/IDFUtilTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,21 @@ public void testGetIDFExtraPaths_WhenIDFPathIsSet_ShouldReturnExpectedPaths()
259259
}
260260

261261
@Test
262-
public void testGetIDFExtraPaths_WhenIDFPathIsEmpty_ShouldReturnEmptyString()
262+
void testGetIDFExtraPaths_WhenIDFPathIsEmpty_ShouldReturnEmptyString()
263263
{
264-
try (MockedConstruction<IDFEnvironmentVariables> mocked = mockConstruction(IDFEnvironmentVariables.class,
265-
(mock, context) -> when(mock.getEnvValue(IDFEnvironmentVariables.IDF_PATH)).thenReturn(""))) //$NON-NLS-1$
264+
try (MockedStatic<IDFUtil> mockedStatic = mockStatic(IDFUtil.class, CALLS_REAL_METHODS))
266265
{
266+
267+
mockedStatic.when(IDFUtil::getIDFPath).thenReturn(""); //$NON-NLS-1$
268+
267269
String result = IDFUtil.getIDFExtraPaths();
270+
268271
assertEquals("", result); //$NON-NLS-1$
269272
}
270273
}
271274

272275
@Test
273-
public void testGetOpenOCDLocation_ShouldReturnOpenOCDScriptsLocationFromIdfEnvVar()
276+
void testGetOpenOCDLocation_ShouldReturnOpenOCDScriptsLocationFromIdfEnvVar()
274277
{
275278
String openocdScriptsLoc = "openocd_path" + File.separator + "share" + File.separator + "openocd" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
276279
+ File.separator + "scripts"; //$NON-NLS-1$

0 commit comments

Comments
 (0)