Commit 3afa6a67 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_test_result: fix some pylint errors on extension.erp5.TestResults

parent 37b795fb
...@@ -10,7 +10,7 @@ separator1 = '=' * 70 ...@@ -10,7 +10,7 @@ separator1 = '=' * 70
separator2 = '-' * 70 separator2 = '-' * 70
RUN_RE = re.compile( RUN_RE = re.compile(
'Ran\s*(?P<all_tests>\d+)\s*test(s)?\s*in\s*(?P<seconds>\d+.\d+)s', r'Ran\s*(?P<all_tests>\d+)\s*test(s)?\s*in\s*(?P<seconds>\d+.\d+)s',
re.DOTALL) re.DOTALL)
STATUS_RE = re.compile(r""" STATUS_RE = re.compile(r"""
...@@ -24,11 +24,11 @@ STATUS_RE = re.compile(r""" ...@@ -24,11 +24,11 @@ STATUS_RE = re.compile(r"""
""", re.DOTALL | re.VERBOSE) """, re.DOTALL | re.VERBOSE)
FTEST_PASS_FAIL_RE = re.compile( FTEST_PASS_FAIL_RE = re.compile(
'.*Functional Tests, (?P<passes>\d+) Passes, (?P<failures>\d+) Failures') r'.*Functional Tests, (?P<passes>\d+) Passes, (?P<failures>\d+) Failures')
SVN_INFO_REV_RE = re.compile("Revision: (?P<rev>\d+)")
TRACEBACK_RE = re.compile(separator1 + "\n(?P<tb>.*)", re.DOTALL) SVN_INFO_REV_RE = re.compile(r"Revision: (?P<rev>\d+)")
TRACEBACK_RE = re.compile(separator1 + "\n(?P<tb>.*)", re.DOTALL) # XXX how does "\n" is interpreted here?
def parseTestSuiteResults(file_handler): def parseTestSuiteResults(file_handler):
""" """
...@@ -36,7 +36,7 @@ def parseTestSuiteResults(file_handler): ...@@ -36,7 +36,7 @@ def parseTestSuiteResults(file_handler):
Return: Return:
- successfull tests - successfull tests
- failed tests - failed tests
- errors - errors
- log files - log files
# Note: this can be debugged with: # Note: this can be debugged with:
...@@ -63,7 +63,7 @@ def parseTestSuiteResults(file_handler): ...@@ -63,7 +63,7 @@ def parseTestSuiteResults(file_handler):
if file_data != '': if file_data != '':
test_results.setdefault(test_name, {})[file_name] = file_data test_results.setdefault(test_name, {})[file_name] = file_data
sorted_test_dict[test_index] = test_name sorted_test_dict[test_index] = test_name
for sort_test_key in sorted(sorted_test_dict.keys()): for sort_test_key in sorted(sorted_test_dict.keys()):
test_id = sorted_test_dict[sort_test_key] test_id = sorted_test_dict[sort_test_key]
test_result_detail = test_results[test_id] test_result_detail = test_results[test_id]
...@@ -116,7 +116,7 @@ def parseTestSuiteResults(file_handler): ...@@ -116,7 +116,7 @@ def parseTestSuiteResults(file_handler):
passes = int(groupdict.get('passes', 0)) passes = int(groupdict.get('passes', 0))
failures = int(groupdict.get('failures', 0)) failures = int(groupdict.get('failures', 0))
all_tests = passes + failures all_tests = passes + failures
else: else:
# get all tests and elapsed time # get all tests and elapsed time
search = RUN_RE.search(test_log) search = RUN_RE.search(test_log)
...@@ -334,48 +334,41 @@ def TestResultModule_viewTestResultChart(self, REQUEST, ...@@ -334,48 +334,41 @@ def TestResultModule_viewTestResultChart(self, REQUEST,
This is experimental use of matplotlib, not integrated with a field. This is experimental use of matplotlib, not integrated with a field.
""" """
return 'disabled' return 'disabled'
# XXX matplotlib cannot be imported it $HOME is not writable ## XXX matplotlib cannot be imported it $HOME is not writable
os.environ['HOME'] = '/tmp' #os.environ['HOME'] = '/tmp'
# use a backend that doesn't need a $DISPLAY ## use a backend that doesn't need a $DISPLAY
try: #import matplotlib
import matplotlib #matplotlib.use('Cairo')
except ImportError: #import pylab
return
matplotlib.use('Cairo') #revision_list = []
try: #all_test_list = []
import pylab #success_list = []
except ImportError:
return #for test in self.searchFolder(
# title=title,
revision_list = [] # int_index=dict(range='minmax',
all_test_list = [] # query=(min_rev or 0,
success_list = [] # max_rev or sys.maxint))):
# test = test.getObject()
for test in self.searchFolder( # if not test.getIntIndex():
title=title, # continue
int_index=dict(range='minmax', # revision_list.append(test.getIntIndex())
query=(min_rev or 0, # all_tests = int(test.getProperty('all_tests', 0))
max_rev or sys.maxint))): # all_test_list.append(all_tests)
test = test.getObject() # failures = (int(test.getProperty('errors', 0)) +
if not test.getIntIndex(): # int(test.getProperty('failures', 0)))
continue # success_list.append(all_tests - failures)
revision_list.append(test.getIntIndex())
all_tests = int(test.getProperty('all_tests', 0)) #pylab.plot(revision_list, all_test_list)
all_test_list.append(all_tests) #pylab.plot(revision_list, success_list)
failures = (int(test.getProperty('errors', 0)) + #pylab.xlabel('svn revision')
int(test.getProperty('failures', 0))) #pylab.legend(['all tests', 'success'])
success_list.append(all_tests - failures)
## returns the image
pylab.plot(revision_list, all_test_list) #out = StringIO()
pylab.plot(revision_list, success_list) #pylab.savefig(out, format='png')
pylab.xlabel('svn revision') #REQUEST.RESPONSE.setHeader('Content-type', 'image/png')
pylab.legend(['all tests', 'success']) #pylab.close()
#return out.getvalue()
# returns the image
out = StringIO()
pylab.savefig(out, format='png')
REQUEST.RESPONSE.setHeader('Content-type', 'image/png')
pylab.close()
return out.getvalue()
...@@ -48,19 +48,8 @@ ...@@ -48,19 +48,8 @@
<tuple> <tuple>
<string>W:265, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)</string> <string>W:265, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)</string>
<string>W:266, 0: Bad indentation. Found 16 spaces, expected 12 (bad-indentation)</string> <string>W:266, 0: Bad indentation. Found 16 spaces, expected 12 (bad-indentation)</string>
<string>W: 13, 0: Anomalous backslash in string: \'\\s\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 13, 0: Anomalous backslash in string: \'\\d\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 13, 0: Anomalous backslash in string: \'\\s\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 13, 0: Anomalous backslash in string: \'\\s\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 13, 0: Anomalous backslash in string: \'\\s\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 13, 0: Anomalous backslash in string: \'\\d\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 13, 0: Anomalous backslash in string: \'\\d\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 27, 0: Anomalous backslash in string: \'\\d\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 27, 0: Anomalous backslash in string: \'\\d\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W: 29, 0: Anomalous backslash in string: \'\\d\'. String constant might be missing an r prefix. (anomalous-backslash-in-string)</string>
<string>W:110, 6: Unused variable \'junk\' (unused-variable)</string> <string>W:110, 6: Unused variable \'junk\' (unused-variable)</string>
<string>W:190, 4: Unused variable \'only_func_test\' (unused-variable)</string> <string>W:190, 4: Unused variable \'only_func_test\' (unused-variable)</string>
<string>W:338, 2: Unreachable code (unreachable)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment