Commit b277c730 authored by Jérome Perrin's avatar Jérome Perrin

test_result: fix pylint messages and enable coding style test

parent 19408915
......@@ -33,7 +33,6 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
import json
import jinja2
from erp5.component.tool.TaskDistributionTool import TaskDistributionTool
class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor, object):
security = ClassSecurityInfo()
......@@ -270,10 +269,10 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor, object):
if current_container == my_value :
return True
elif isinstance(current_container, dict):
for k,v in current_container.items():
for k, v in current_container.items():
if str(my_value) in str(k):
return True
if _isInMyDictOrList(current_container[k]) :
if _isInMyDictOrList(v) :
return True
elif isinstance(current_container, list):
for sub_container in current_container:
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ERP5ScalabilityDistributor</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.ERP5ScalabilityDistributor</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
from Products.ERP5Type.XMLObject import XMLObject
from DateTime import DateTime
from zLOG import LOG,INFO,ERROR
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>TestNode</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.TestNode</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
from Products.ERP5Type.XMLObject import XMLObject
from DateTime import DateTime
from zLOG import LOG,INFO,ERROR
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Products.ERP5Type import Permissions
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>TestSuite</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.TestSuite</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -31,12 +31,12 @@ import json
def getGeneratedConfigurationList(self, *args, **kw):
document_list = []
template = jinja2.Template(self.getClusterConfiguration())
max = len(self.getGraphCoordinate())
max_ = len(self.getGraphCoordinate())
max_comp = 100
#max = self.getNumberConfiguration()
comp_list_view = [ "COMP-%i" %(x) for x in range(0,max_comp) ]
for count in xrange(1, max+1):
for count in xrange(1, max_+1):
template_vars = { "count" : count, "comp" : comp_list_view }
output_text = template.render(template_vars)
description = json.dumps(json.loads(output_text), sort_keys=True, indent=4, separators=(',', ': '))
......@@ -73,12 +73,12 @@ def generateConfigurationList(self, test_suite_title):
def _isInMyDictOrListRec(my_container, my_value):
def _isInMyDictOrList(current_container):
if current_container == my_value :
return True
elif type(current_container) == type({}):
for k,v in current_container.items():
if _isInMyDictOrList(current_container[k]) :
return True
elif isinstance(current_container, dict):
for v in current_container.values():
if _isInMyDictOrList(v) :
return True
elif type(current_container) == type([]):
elif isinstance(current_container, list):
for sub_container in current_container:
if _isInMyDictOrList(sub_container) :
return True
......@@ -97,8 +97,6 @@ def generateConfigurationList(self, test_suite_title):
lll = portal_task_distribution.searchFolder(title=test_suite.getSpecialiseTitle())
distributor_uid = lll[0].getUid()
cluster_configuration = test_suite.getClusterConfiguration()
cluster_constraint = test_suite.getClusterConstraint()
#number_configuration = test_suite.getNumberConfiguration()
number_configuration = len(test_suite.getGraphCoordinate())
randomized_path = test_suite.getRandomizedPath()
# Get testnodes available for this distributor
......@@ -134,8 +132,8 @@ def generateConfigurationList(self, test_suite_title):
return_dict['launchable'] = True
return_dict['configuration_list'] = configuration_list_json
return_dict['launcher_nodes_computer_guid'] = launcher_nodes_computer_guid
except:
return_dict['error_message'] = 'Bad json cluster_configuration ?'
except Exception as e:
return_dict['error_message'] = 'Bad json cluster_configuration. %s' % str(e)
_unvalidateConfig(return_dict)
# If the number of available nodes is lower than
......
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ScalabilityTestSuiteUtils</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.ScalabilityTestSuiteUtils</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -2,8 +2,6 @@ import difflib
import zipfile
import os
import re
import sys
from cStringIO import StringIO
from zExceptions import Unauthorized
separator1 = '=' * 70
......@@ -107,7 +105,7 @@ def parseTestSuiteResults(file_handler):
if is_zelenium_test_suite:
# if this was a zelenium functional test, the output is completly
# different
junk, title, summary, detail = stdout.split('-' * 79)
_, title, summary, detail = stdout.split('-' * 79)
test_result_detail['stdout'] = summary
html_test_result = detail
search = FTEST_PASS_FAIL_RE.search(title)
......@@ -187,7 +185,6 @@ def TestResult_sendEmailNotification(self, mail_to=None, mail_from=None,
failed_test_case_list = []
with_skips_test_case_list = []
unknown_status_test_case_list = []
only_func_test = 1
for tcr in test_result.contentValues(portal_type='Test Result Line',
sort_on='title'):
if (tcr.getProperty('errors', 0) + tcr.getProperty('failures', 0)):
......@@ -197,12 +194,6 @@ def TestResult_sendEmailNotification(self, mail_to=None, mail_from=None,
unknown_status_test_case_list.append(tcr)
if tcr.getProperty('skips'):
with_skips_test_case_list.append(tcr)
if not tcr.getProperty('html_test_result'):
only_func_test = 0
# Don't send mail if we only run functional tests
#if only_func_test:
# return
p('Test Suite: %s' % test_result.getTitle())
p('Revision: %s' % test_result.getReference() or test_result.getIntIndex())
......@@ -262,8 +253,8 @@ def TestResult_sendEmailNotification(self, mail_to=None, mail_from=None,
for tcr in with_skips_test_case_list:
p('\n %-50s (%s skips)' % (tcr.getTitle(), tcr.getProperty('skips')))
for line in tcr.getProperty('stderr', '').splitlines():
if 'skipped ' in line:
p(' %s' % line)
if 'skipped ' in line:
p(' %s' % line)
p('')
return ('\n'.join(mail_body),
......
......@@ -45,12 +45,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<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:110, 6: Unused variable \'junk\' (unused-variable)</string>
<string>W:190, 4: Unused variable \'only_func_test\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>result, error_message_list=[]</string> </value>
<value> <string>result, error_message_list=()</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ZSQLCatalog.SQLCatalog import Query
from DateTime import DateTime
now = DateTime()
#Clean-up invalidated Test Nodes and
......@@ -24,7 +23,7 @@ for test_node in list_node:
if ping_date <= old_date:
test_node.invalidate()
elif validation_state == 'invalidated':
__traceback_info__ = test_node
__traceback_info__ = test_node # pylint:disable=unused-variable
if test_node.getSpecialise():
test_node.getSpecialiseValue().cleanupInvalidatedTestNode(test_node)
......
......@@ -18,8 +18,6 @@ if a.getIntIndex() > b.getIntIndex():
b_title_dict = dict((line.getObject().getTitle(), line.id) for line \
in b.searchFolder(portal_type='Test Result Line'))
not_in_b = {}
object_list = []
compared_prop_list = ('all_tests', 'errors', 'failures', 'skips')
......
from Products.PythonScripts.standard import Object
import json
# Get result lines
......
......@@ -14,7 +14,7 @@ p('Revision: %s' % test_result.getReference() or test_result.getIntIndex())
p('Launch Date: %s' % test_result.getStartDate())
comment = test_result.getProperty('comment')
if comment:
p(comment)
p(comment)
p('')
p('All tests: %s, Failures: %s, Errors: %s, Skips: %s' % \
(test_result.getProperty('all_tests'),
......
......@@ -15,4 +15,4 @@ test_suite = context.newContent(
)
if batch_mode:
return test_suite
return test_suite
import json
context.REQUEST.response.setHeader('Access-Control-Allow-Origin', '*')
error = []
#We should verify if the project actually exists
if context.getTitle() is None:
error.append('ERROR: No project associated!')
error.append('ERROR: No project associated!')
if context.getTestSuite() is None:
error.append('ERROR: No test-suite associated!')
error.append('ERROR: No test-suite associated!')
if context.getTestSuiteTitle() is None:
error.append('ERROR: No test-suite-title associated!')
error.append('ERROR: No test-suite-title associated!')
vcs_repository_list = context.objectValues(portal_type="Test Suite Repository")
if len(vcs_repository_list) == 0 :
error.append("No vcs_repository_list! (minimum 1)")
error.append("No vcs_repository_list! (minimum 1)")
else:
profile_count = 0
for vcs_list in vcs_repository_list:
for property_name in ['git_url','buildout_section_id','branch']:
property_value = vcs_list.getProperty(property_name)
if property_value is None:
error.append('ERROR: No '+property_name+'!')
if not(vcs_list.getProperty('profile_path') is None):
profile_count += 1
if profile_count == 0:
profile_count = 0
for vcs_list in vcs_repository_list:
for property_name in ['git_url','buildout_section_id','branch']:
property_value = vcs_list.getProperty(property_name)
if property_value is None:
error.append('ERROR: No '+property_name+'!')
if not(vcs_list.getProperty('profile_path') is None):
profile_count += 1
if profile_count == 0:
error.append('ERROR: No profile_path in any vcs_repository! (minimum 1)')
return len(error) >0
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
......@@ -20,7 +20,7 @@ if test_suite.getReference() is None:
def generateRandomString(size):
tab = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
my_string = ''
for i in range(size):
for _ in range(size):
my_string = my_string + choice(tab)
return my_string
......
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
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