Skip to content

Commit

Permalink
Merge pull request #29 from kbase/sdkdev
Browse files Browse the repository at this point in the history
Move module renamer tests to shared temp test dir
  • Loading branch information
MrCreosote authored Jan 28, 2025
2 parents 58dd884 + a05e553 commit 03dde8a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,5 @@ src/java/us/kbase/mobu/git.properties
/ASimpleModule_for_unit_testingSelf/
/a_SimpleModule_for_unit_testing_java/
/a_SimpleModule_for_unit_testing_python/
/a_SimpleModule_for_unit_testing_perl/
/ASimpleModule_for_unit_testingPythonError/
/a_SimpleModule_for_rename_unit_testing_python/
/temp_kbsdkplus_test/
4 changes: 0 additions & 4 deletions src/java/us/kbase/mobu/initializer/ModuleInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public class ModuleInitializer {
"ui/narrative",
"ui/narrative/methods"};

public ModuleInitializer(String moduleName, String userName, boolean verbose) {
this(moduleName, userName, DEFAULT_LANGUAGE, verbose);
}

public ModuleInitializer(String moduleName, String userName, String language, boolean verbose) {
this(moduleName, userName, language, verbose, null);
}
Expand Down
22 changes: 16 additions & 6 deletions src/java/us/kbase/mobu/renamer/test/ModuleRenamerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -54,14 +57,21 @@ public static void tearDownModule() throws IOException {
}

private static File initRepo(String lang) throws Exception {
String moduleName = SIMPLE_MODULE_NAME + "_" + lang;
File ret = new File(moduleName);
if (ret.exists())
final String moduleName = SIMPLE_MODULE_NAME + "_" + lang;
final Path workDir = Paths.get(TestConfigHelper.getTempTestDir(), moduleName);
Files.createDirectories(workDir);
final File ret = workDir.toFile();
if (ret.exists()) {
FileUtils.deleteDirectory(ret);
}
dirsToRemove.add(ret);
ModuleInitializer initer = new ModuleInitializer(moduleName,
token.getUserName(), lang, false);
initer.initialize(true);
new ModuleInitializer(
moduleName,
token.getUserName(),
lang,
false,
new File(TestConfigHelper.getTempTestDir())
).initialize(true);
return ret;
}

Expand Down

0 comments on commit 03dde8a

Please sign in to comment.