running all tests in folder rewritten in Jython compatible way; test added

This commit is contained in:
Dmitry Jemerov
2009-06-10 20:31:32 +04:00
parent 6649968ffd
commit 581367ff4c
3 changed files with 19 additions and 4 deletions
+6 -4
View File
@@ -32,12 +32,14 @@ def loadSource(fileName):
modules[moduleName] = module
return module
def walkModules(modules, dirname, names):
for name in names:
if name.endswith(".py"):
modules.append(loadSource(os.path.join(dirname, name)))
def loadModulesFromFolderRec(folder):
modules = []
for root, dirs, files in os.walk(folder, topdown=False):
for name in files:
if name.endswith(".py"):
modules.append(loadSource(os.path.join(root, name)))
os.path.walk(folder, walkModules, modules)
return modules
testLoader = unittest.TestLoader()
@@ -0,0 +1,7 @@
import unittest
class SubTest(unittest.TestCase):
def test_in_subfolder(self):
self.assertEquals("foo", "fo" + "o")
@@ -62,6 +62,12 @@ public class PyTestRunnerTest extends LightPlatformTestCase {
assertEquals(3, result.length);
}
public void testFolder() throws ExecutionException {
final File testDir = new File(PathManager.getHomePath(), "plugins/python/testData/testRunner/tests");
String[] result = runUTRunner(testDir.getPath(), testDir.getPath() + "/");
assertEquals(8, result.length);
}
private static String[] runUTRunner(String workDir, String... args) throws ExecutionException {
File helpersDir = new File(PathManager.getHomePath(), "plugins/python/helpers");
File utRunner = new File(helpersDir, "pycharm/utrunner.py");