Skip to content

Commit 584d68c

Browse files
author
Ezequiel Torres
committed
Changes in integration tests to run in Python3
1 parent 9f81006 commit 584d68c

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

tests/integration_tests/integration_tests.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ def test_generation_7(self):
183183
self._run_x_generation(7)
184184

185185
def _run_x_generation(self, gen_number):
186-
print "Checking Generation %s" % gen_number
186+
print("Checking Generation %s" % gen_number)
187187

188-
print "Check Indvidual properties..."
188+
print("Check Indvidual properties...")
189189
self._check_indiv_values(gen_number)
190190

191-
print "Check Indvidual properties..."
191+
print("Check Indvidual properties...")
192192
pop = self._mlc.get_generation(MLCIntegrationTest.EXPERIMENT_NAME, gen_number)
193193
self._check_indiv_property(gen_number, pop.get_individuals(), 'index', 'int')
194194
self._check_indiv_property(gen_number, pop.get_costs(), 'cost', 'float')
@@ -199,7 +199,7 @@ def _run_x_generation(self, gen_number):
199199
def _check_indiv_values(self, gen_number):
200200
i = 1
201201
indexes = self._mlc.get_generation(MLCIntegrationTest.EXPERIMENT_NAME, gen_number).get_individuals()
202-
print "Check %s indviduals from generation %s" % (len(indexes), gen_number)
202+
print("Check %s indviduals from generation %s" % (len(indexes), gen_number))
203203
for index in indexes:
204204
indiv = MLCRepository.get_instance().get_individual(index)
205205

@@ -243,9 +243,9 @@ class IntegrationTest(MLCIntegrationTest):
243243

244244

245245
def execute_integration_test(test_dir, integration_test):
246-
print "Running '%s' with %s generations: %s" % (integration_test['name'],
246+
print("Running '%s' with %s generations: %s" % (integration_test['name'],
247247
integration_test['generations'],
248-
integration_test['description'])
248+
integration_test['description']))
249249
suite = unittest.TestSuite()
250250
loader = unittest.TestLoader()
251251
suite.addTests(loader.loadTestsFromTestCase(get_test_class(test_dir, integration_test)))
@@ -264,7 +264,7 @@ def execute_integration_test(test_dir, integration_test):
264264
if test_name in all_tests:
265265
test_to_run[test_name] = all_tests[test_name]
266266
else:
267-
print "'%s'? there is no integration test with that name!" % test_name
267+
print("'%s'? there is no integration test with that name!" % test_name)
268268

269269
for test_dir, integration_test in test_to_run.items():
270270
execute_integration_test(test_dir, integration_test)

tests/integration_tests/run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Put the absolute path where the 'shared' python was installed
44
export PYTHONPATH=$PYTHONPATH:../../
5-
NOSETESTS=/opt/mlc-python-2.7.11/bin/mlc_python
5+
NOSETESTS=/opt/mlc-python-3.6.2/bin/mlc_python
66

77
# Run Integration tests
88
$NOSETESTS integration_tests.py $@

tests/integration_tests/test_basic/default_evaluation_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def cost(indiv):
7878
cost_mlc_y3 = None
7979
try:
8080
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
81-
except FloatingPointError, err:
81+
except FloatingPointError as err:
8282
np.seterr(all='ignore')
8383
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
8484
np.seterr(all='raise')

tests/integration_tests/test_multiple_controls/default_evaluation_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def cost(indiv):
7878
cost_mlc_y3 = None
7979
try:
8080
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
81-
except FloatingPointError, err:
81+
except FloatingPointError as err:
8282
np.seterr(all='ignore')
8383
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
8484
np.seterr(all='raise')

tests/integration_tests/test_persist_reusing_simulations/default_evaluation_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def cost(indiv):
7878
cost_mlc_y3 = None
7979
try:
8080
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
81-
except FloatingPointError, err:
81+
except FloatingPointError as err:
8282
np.seterr(all='ignore')
8383
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
8484
np.seterr(all='raise')

tests/integration_tests/test_persist_simulation/default_evaluation_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def cost(indiv):
7878
cost_mlc_y3 = None
7979
try:
8080
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
81-
except FloatingPointError, err:
81+
except FloatingPointError as err:
8282
np.seterr(all='ignore')
8383
cost_mlc_y3 = float(np.sum((mlc_y3 - y2)**2))
8484
np.seterr(all='raise')

0 commit comments

Comments
 (0)