9 from java
.lang
import System
11 from org
.springframework
.context
.support
import FileSystemXmlApplicationContext
14 applicationContext
= None
16 def walktree(dir, callback
, result
):
17 '''recursively descend the directory rooted at dir,
18 calling the callback function for each regular file'''
19 for f
in os
.listdir(dir):
20 pathname
= '%s/%s' % (dir, f
)
21 if os
.path
.isdir(pathname
):
22 # It's a directory, recurse into it
23 walktree(pathname
, callback
, result
)
24 elif os
.path
.isfile(pathname
):
25 # It's a file, call the callback function
27 callback(pathname
, f
, result
)
29 # Unknown file type, print a message
30 print 'Skipping %s' % pathname
32 def visitfile(path
, file, result
):
34 if file == "all_tests.py" or file == 'config.py' or file == 'all_tests_prod.py' or file == 'all_single_test.py':
36 print "test file: %s" % file
37 execfile(path
, globals())
40 while tests
.hasMoreElements():
41 et
= tests
.nextElement()
43 TOTAL_TESTS
= TOTAL_TESTS
+ 1
45 if __name__
== '__main__':
47 # load the application context
48 print "Application Context: %s" % sys
.argv
[2]
50 # Load the multiple config files
51 arr
= [sys
.argv
[2], sys
.argv
[3]]
53 applicationContext
= FileSystemXmlApplicationContext(arr
)
54 suite_result
= junit
.framework
.TestSuite()
55 walktree(os
.path
.join(os
.getcwd(), "py"), visitfile
, suite_result
)
57 junit
.textui
.TestRunner
.run(suite_result
)
58 print "Total Tests: %s" % TOTAL_TESTS