From 308289497ee5f28777ace23606b74b83d1fe6dbf Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Tue, 11 Aug 2015 11:24:22 +0100 Subject: [PATCH] tests: make tests work on python3 Signed-off-by: Brendan Le Foll --- tests/general_checks.py | 6 ++++-- tests/gpio_checks.py | 2 ++ tests/platform_checks.py | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/general_checks.py b/tests/general_checks.py index dfa991c..ae1521e 100755 --- a/tests/general_checks.py +++ b/tests/general_checks.py @@ -22,13 +22,15 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import unittest as u +from __future__ import print_function + import mraa as m +import unittest as u class GeneralChecks(u.TestCase): def test_mraa_version(self): self.version = m.getVersion() - print "Version is: " + self.version + print("Version is: " + self.version) self.assertIsNotNone(self.version) if __name__ == "__main__": diff --git a/tests/gpio_checks.py b/tests/gpio_checks.py index 261cdb4..506697c 100755 --- a/tests/gpio_checks.py +++ b/tests/gpio_checks.py @@ -22,6 +22,8 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +from __future__ import print_function + import mraa as m import unittest as u import os, re, sys diff --git a/tests/platform_checks.py b/tests/platform_checks.py index f9ea725..fffa7fa 100755 --- a/tests/platform_checks.py +++ b/tests/platform_checks.py @@ -22,8 +22,10 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import unittest as u +from __future__ import print_function + import mraa as m +import unittest as u @u.skipIf(m.init() != m.ERROR_PLATFORM_ALREADY_INITIALISED, "mraa_init() not valid") class PlatformChecks(u.TestCase): @@ -33,12 +35,12 @@ class PlatformChecks(u.TestCase): def test_mraa_check_platform_ADC_max_resolution(self): self.p_ADC_mres = m.adcRawBits() - print "Platform ADC max. resolution is: " + str(self.p_ADC_mres) + " bits" + print("Platform ADC max. resolution is: " + str(self.p_ADC_mres) + " bits") self.assertEqual(self.p_ADC_mres, 12, "Wrong ADC max. resolution. Check platform ...") def test_mraa_check_platform_ADC_resolution(self): self.p_ADC_res = m.adcSupportedBits() - print "Platform ADC resolution is: " + str(self.p_ADC_res) + " bits" + print("Platform ADC resolution is: " + str(self.p_ADC_res) + " bits") self.assertEqual(self.p_ADC_res, 10, "Wrong ADC suported resolution. Check platform ...") if __name__ == "__main__": -- 2.7.4