don't call variables 'file', it's a reserved word :)

This commit is contained in:
Bernardo Damele 2010-10-15 10:29:24 +00:00
parent c5e385f77a
commit a80f6110cd

View File

@ -36,14 +36,14 @@ def smokeTest():
retVal = True retVal = True
count, length = 0, 0 count, length = 0, 0
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): for _, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
for file in files: for ifile in files:
length += 1 length += 1
for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH): for root, _, files in os.walk(paths.SQLMAP_ROOT_PATH):
for file in files: for ifile in files:
if os.path.splitext(file)[1].lower() == '.py' and file != '__init__.py': if os.path.splitext(ifile)[1].lower() == '.py' and ifile != '__init__.py':
path = os.path.join(root, os.path.splitext(file)[0]) path = os.path.join(root, os.path.splitext(ifile)[0])
path = path.replace(paths.SQLMAP_ROOT_PATH, '.') path = path.replace(paths.SQLMAP_ROOT_PATH, '.')
path = path.replace(os.sep, '.').lstrip('.') path = path.replace(os.sep, '.').lstrip('.')
try: try:
@ -52,7 +52,7 @@ def smokeTest():
except Exception, msg: except Exception, msg:
retVal = False retVal = False
dataToStdout("\r") dataToStdout("\r")
errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(paths.SQLMAP_ROOT_PATH, file), msg) errMsg = "smoke test failed at importing module '%s' (%s):\n%s" % (path, os.path.join(paths.SQLMAP_ROOT_PATH, ifile), msg)
logger.error(errMsg) logger.error(errMsg)
else: else:
# Run doc tests # Run doc tests
@ -62,7 +62,7 @@ def smokeTest():
retVal = False retVal = False
count += 1 count += 1
status = '%d/%d (%d%s)' % (count, length, round(100.0*count/length), '%') status = '%d/%d (%d%s) ' % (count, length, round(100.0*count/length), '%')
dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status)) dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
dataToStdout("\r%s\r" % (" "*(getConsoleWidth()-1))) dataToStdout("\r%s\r" % (" "*(getConsoleWidth()-1)))
@ -189,9 +189,9 @@ def runCase(name=None, switches=None, log=None, session=None):
retVal = False retVal = False
if session and retVal: if session and retVal:
file = open(conf.sessionFile, 'r') ifile = open(conf.sessionFile, 'r')
content = file.read() content = ifile.read()
file.close() ifile.close()
for item in session: for item in session:
if item.startswith("r'") and item.endswith("'"): if item.startswith("r'") and item.endswith("'"):
if not re.search(item[2:-1], content): if not re.search(item[2:-1], content):
@ -202,9 +202,9 @@ def runCase(name=None, switches=None, log=None, session=None):
break break
if log and retVal: if log and retVal:
file = open(conf.dumper.getOutputFile(), 'r') ifile = open(conf.dumper.getOutputFile(), 'r')
content = file.read() content = ifile.read()
file.close() ifile.close()
for item in log: for item in log:
if item.startswith("r'") and item.endswith("'"): if item.startswith("r'") and item.endswith("'"):
if not re.search(item[2:-1], content): if not re.search(item[2:-1], content):