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
separator2 = '-' * 70
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)
STATUS_RE = re.compile(r"""
......@@ -24,11 +24,11 @@ STATUS_RE = re.compile(r"""
""", re.DOTALL | re.VERBOSE)
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+)")
SVN_INFO_REV_RE = re.compile(r"Revision: (?P<rev>\d+)")
TRACEBACK_RE = re.compile(separator1 + "\n(?P<tb>.*)", re.DOTALL)
TRACEBACK_RE = re.compile(separator1 + "\n(?P<tb>.*)", re.DOTALL) # XXX how does "\n" is interpreted here?
def parseTestSuiteResults(file_handler):
"""
......@@ -334,48 +334,41 @@ def TestResultModule_viewTestResultChart(self, REQUEST,
This is experimental use of matplotlib, not integrated with a field.
"""
return 'disabled'
# XXX matplotlib cannot be imported it $HOME is not writable
os.environ['HOME'] = '/tmp'
# use a backend that doesn't need a $DISPLAY
try:
import matplotlib
except ImportError:
return
matplotlib.use('Cairo')
try:
import pylab
except ImportError:
return
revision_list = []
all_test_list = []
success_list = []
for test in self.searchFolder(
title=title,
int_index=dict(range='minmax',
query=(min_rev or 0,
max_rev or sys.maxint))):
test = test.getObject()
if not test.getIntIndex():
continue
revision_list.append(test.getIntIndex())
all_tests = int(test.getProperty('all_tests', 0))
all_test_list.append(all_tests)
failures = (int(test.getProperty('errors', 0)) +
int(test.getProperty('failures', 0)))
success_list.append(all_tests - failures)
pylab.plot(revision_list, all_test_list)
pylab.plot(revision_list, success_list)
pylab.xlabel('svn revision')
pylab.legend(['all tests', 'success'])
# returns the image
out = StringIO()
pylab.savefig(out, format='png')
REQUEST.RESPONSE.setHeader('Content-type', 'image/png')
pylab.close()
return out.getvalue()
## XXX matplotlib cannot be imported it $HOME is not writable
#os.environ['HOME'] = '/tmp'
## use a backend that doesn't need a $DISPLAY
#import matplotlib
#matplotlib.use('Cairo')
#import pylab
#revision_list = []
#all_test_list = []
#success_list = []
#for test in self.searchFolder(
# title=title,
# int_index=dict(range='minmax',
# query=(min_rev or 0,
# max_rev or sys.maxint))):
# test = test.getObject()
# if not test.getIntIndex():
# continue
# revision_list.append(test.getIntIndex())
# all_tests = int(test.getProperty('all_tests', 0))
# all_test_list.append(all_tests)
# failures = (int(test.getProperty('errors', 0)) +
# int(test.getProperty('failures', 0)))
# success_list.append(all_tests - failures)
#pylab.plot(revision_list, all_test_list)
#pylab.plot(revision_list, success_list)
#pylab.xlabel('svn revision')
#pylab.legend(['all tests', 'success'])
## 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 @@
<tuple>
<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: 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:190, 4: Unused variable \'only_func_test\' (unused-variable)</string>
<string>W:338, 2: Unreachable code (unreachable)</string>
</tuple>
</value>
</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