[infinispan-commits] Infinispan SVN: r151 - trunk/bin.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Mon Apr 20 07:32:48 EDT 2009
Author: manik.surtani at jboss.com
Date: 2009-04-20 07:32:48 -0400 (Mon, 20 Apr 2009)
New Revision: 151
Modified:
trunk/bin/findDisabledTests.py
Log:
Added version compatibility
Modified: trunk/bin/findDisabledTests.py
===================================================================
--- trunk/bin/findDisabledTests.py 2009-04-20 11:24:23 UTC (rev 150)
+++ trunk/bin/findDisabledTests.py 2009-04-20 11:32:48 UTC (rev 151)
@@ -1,19 +1,27 @@
#!/usr/bin/python
-from __future__ import with_statement
import os
import fnmatch
import re
import time
import sys
-def assertValidPython():
- if (sys.version < 2.5):
- raise Error("Incompatible version of Python. Need at least Python 2.5.0")
+### Crappy implementation of creating a Set from a List. To cope with older Python versions
+def toSet(list):
+ tempDict = {}
+ for entry in list:
+ tempDict[entry] = "dummy"
+ return tempDict.keys()
+def getSearchPath(executable):
+ inBinDir = re.compile('^.*/?bin/.*.py')
+ if inBinDir.search(executable):
+ return "./"
+ else:
+ return "../"
-assertValidPython()
+def stripLeadingDots(filename):
+ return filename.strip('/. ')
-
class GlobDirectoryWalker:
# a forward iterator that traverses a directory tree
@@ -41,16 +49,6 @@
if fnmatch.fnmatch(file, self.pattern):
return fullname
-def getSearchPath(executable):
- inBinDir = re.compile('^.*/?bin/.*.py')
- if inBinDir.search(executable):
- return "./"
- else:
- return "../"
-
-def stripLeadingDots(filename):
- return filename.strip('/. ')
-
## Walk through all files that end with Test.java
startTime = time.clock()
disabledTestFiles = []
@@ -59,15 +57,18 @@
disabledMatcher = re.compile('enabled\s*=\s*false')
for testFile in GlobDirectoryWalker(getSearchPath(sys.argv[0]), '*Test.java'):
- with open(testFile) as tf:
+ tf = open(testFile)
+ try:
for line in tf:
if testAnnotationMatcher.search(line):
if disabledMatcher.search(line):
disabledTestFiles.append(testFile)
break
+ finally:
+ tf.close()
print "Files containing disabled tests: \n"
-uniqueTests=set(disabledTestFiles)
+uniqueTests=toSet(disabledTestFiles)
i=1
for f in uniqueTests:
print str(i) + ". " + stripLeadingDots(f)
More information about the infinispan-commits
mailing list