# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2011-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2011-2016 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
lines = stream.readlines()
stream.close()
for line in lines:
- if not termcolor.canDisplayColor(sys.stdout):
- msg = line.split('\n')[0]
- else:
+ if not termcolor.canDisplayColor(sys.stdout):
+ msg = line.split('\n')[0]
+ else:
msg = termcolor.makeColoredMessage(line.split('\n')[0], termcolor.BLUE)
- print msg
+ print(msg)
import os
import unittest
from unittest import TestCase
-from uiexception import DevelException
+from .uiexception import DevelException
## This class is a simple wrapper of the pyunit framework.
# \ingroup pyunittester
for suite in self.__listTestSuite:
runner.run(suite)
- # Finally close the ouput stream and print the report
+ # Finally close the output stream and print the report
logfile.close()
self.printreport()
if result is None:
return True
return result
- except Exception, e:
- print e
+ except Exception as e:
+ print(e)
return False
# Simple helper function for most cases where there is only one
class MyTestCase(unittest.TestCase):
def test_myTestOk_01(self):
r=True
- print "myTestOk_01: should be OK"
+ print("myTestOk_01: should be OK")
self.assertTrue(r)
def test_myTestOk_02(self):
r=True
- print "myTestOk_02: should be OK"
+ print("myTestOk_02: should be OK")
self.assertTrue(r)
def test_myTestNotOk(self):
r=False
- print "myTestNotOk: should be NOT OK"
+ print("myTestNotOk: should be NOT OK")
self.assertTrue(r)
def functionRaisingAnException():
return True
def functionReturningNothing():
- print "functionReturningNothing"
+ print("functionReturningNothing")
class MyTestCase2(unittest.TestCase):
def test_myTest_01(self):
r=execAndConvertExceptionToBoolean(functionRaisingAnException)
- print "test 01: this test should be NOT OK"
+ print("test 01: this test should be NOT OK")
self.assertTrue(r)
def test_myTest_02(self):
r=execAndConvertExceptionToBoolean(functionReturningFalse)
- print "test 02: this test should be NOT OK"
+ print("test 02: this test should be NOT OK")
self.assertTrue(r)
def test_myTest_03(self):
r=execAndConvertExceptionToBoolean(functionReturningTrue)
- print "test 03: this test should be OK"
+ print("test 03: this test should be OK")
self.assertTrue(r)
def test_myTest_04(self):
r=execAndConvertExceptionToBoolean(functionReturningNothing)
- print "test 04: this test should be OK"
+ print("test 04: this test should be OK")
self.assertTrue(r)
def test_myTest_05(self):
r=True
- print "test 05: this test should be OK"
+ print("test 05: this test should be OK")
self.assertTrue(r)