Commit 918c6dd4 authored by Jérome Perrin's avatar Jérome Perrin

test_result: py3

parent f313c75c
......@@ -24,6 +24,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from __future__ import division
from Products.ERP5Type.XMLObject import XMLObject
from DateTime import DateTime
import json
......@@ -214,17 +215,17 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
# suites required
int_index = test_suite.getIntIndex()
# we divide per 3 because we have 3 cores per node
node_quantity_min = PRIORITY_MAPPING[int_index][0]/3
node_quantity_max = PRIORITY_MAPPING[int_index][1]/3
node_quantity_min = PRIORITY_MAPPING[int_index][0] // 3
node_quantity_max = PRIORITY_MAPPING[int_index][1] // 3
for x in range(0, node_quantity_min):
score = float(x)/(x+1)
score = float(x) / (x + 1)
all_test_suite_list.append((score, test_suite_url, title))
test_suite_score.setdefault(test_suite_url, []).append(score)
# additional suites, lower score
for x in range(0, node_quantity_max -
node_quantity_min ):
score = float(1) + x/(x+1)
all_test_suite_list.append((1 + x/(x+1), test_suite_url, title))
score = float(1) + x // (x + 1)
all_test_suite_list.append((1 + x // (x + 1), test_suite_url, title))
test_suite_score.setdefault(test_suite_url, []).append(score)
all_test_suite_list.sort(key=lambda x: (x[0], x[2]))
return test_suite_score, [x[1] for x in all_test_suite_list]
......@@ -326,7 +327,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
# This allows to affect more test nodes to test suites with higher priority
wanted_test_core_quantity = PRIORITY_MAPPING[test_suite.getIntIndex()][1]
factor = float(max_test_core_per_suite) / wanted_test_core_quantity
missing_quantity = wanted_test_core_quantity/3 - len(test_result.objectValues(portal_type="Test Result Node"))
missing_quantity = wanted_test_core_quantity // 3 - len(test_result.objectValues(portal_type="Test Result Node"))
key = (max_test_core_per_suite - missing_quantity * 3 * factor, modification_date)
else:
key = (0, random.random())
......
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