Skip to content

Commit 883bdb2

Browse files
authored
Merge pull request #208 from ARMmbed/py3-fixes
Fixes for Python 3 compatibility
2 parents 2a00017 + ce78dec commit 883bdb2

File tree

7 files changed

+15
-16
lines changed

7 files changed

+15
-16
lines changed

packages/mbed-greentea/mbed_greentea/mbed_greentea_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def run_test_thread(test_result_queue, test_queue, opts, mut, build, build_path,
569569
# In some cases we want to print console to see why test failed
570570
# even if we are not in verbose mode
571571
gt_logger.gt_log_tab("test failed, reporting console output (specified with --report-fails option)")
572-
print
572+
print()
573573
print(single_test_output)
574574

575575
#greentea_release_target_id(mut['target_id'], gt_instance_uuid)

src/mbed_os_tools/detect/lstools_base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
LOCAL_PLATFORM_DATABASE,
2929
LOCAL_MOCKS_DATABASE,
3030
)
31+
from future.utils import with_metaclass
3132

3233
mbedls_root_logger = logging.getLogger("mbedls")
3334
mbedls_root_logger.setLevel(logging.WARNING)
@@ -56,13 +57,11 @@ class FSInteraction(object):
5657
Never = 3
5758

5859

59-
class MbedLsToolsBase(object):
60+
class MbedLsToolsBase(with_metaclass(ABCMeta, object)):
6061
""" Base class for mbed-lstools, defines mbed-ls tools interface for
6162
mbed-enabled devices detection for various hosts
6263
"""
6364

64-
__metaclass__ = ABCMeta
65-
6665
# Which OSs are supported by this module
6766
# Note: more than one OS can be supported by mbed-lstools_* module
6867
os_supported = []

src/mbed_os_tools/test/mbed_greentea_hooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525

2626

27-
class GreenteaTestHook():
27+
class GreenteaTestHook(object):
2828
"""! Class used to define
2929
"""
3030
name = None
@@ -204,7 +204,7 @@ def check_if_file_exists_or_is_empty(expr):
204204
result = result.replace('>>', '')
205205
return result
206206

207-
class GreenteaHooks():
207+
class GreenteaHooks(object):
208208
"""! Class used to store all hooks
209209
@details Hooks command starts with '$' dollar sign
210210
"""

src/mbed_os_tools/test/mbed_greentea_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
COLORAMA = False
2323

2424

25-
class GreenTeaSimpleLockLogger:
25+
class GreenTeaSimpleLockLogger(object):
2626
"""! Simple locking printing mechanism
2727
@details We are using parallel testing
2828
"""

src/mbed_os_tools/test/mbed_report_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def export_to_file(file_name, payload):
2424
with open(file_name, 'w') as f:
2525
f.write(payload)
2626
except IOError as e:
27-
print("Exporting report to file failed: ", str(e))
27+
print("Exporting report to file failed: %s" % str(e))
2828
result = False
2929
return result
3030

src/mbed_os_tools/test/mbed_yotta_module_parse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import json
1818

1919

20-
class YottaConfig():
20+
class YottaConfig(object):
2121

2222
yotta_config = None
2323

@@ -75,7 +75,7 @@ def get_test_pins(self):
7575
return None
7676

7777

78-
class YottaModule():
78+
class YottaModule(object):
7979

8080
__yotta_module = None
8181
__greentea_client = 'greentea-client'
@@ -97,7 +97,7 @@ def init(self):
9797
with open(path, 'r') as data_file:
9898
self.__yotta_module = json.load(data_file)
9999
except IOError as e:
100-
print("YottaModule: error - ", str(e))
100+
print("YottaModule: error - %s" % str(e))
101101
return bool(self.__yotta_module) # bool({}) == False
102102

103103
def set_yotta_module(self, yotta_module):

src/mbed_os_tools/test/tests_spec.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import json
2323

2424

25-
class TestBinary:
25+
class TestBinary(object):
2626
"""
2727
Class representing a Test Binary.
2828
"""
@@ -66,7 +66,7 @@ def get_compare_log(self):
6666
return self.__comp_log
6767

6868

69-
class Test:
69+
class Test(object):
7070
"""
7171
class representing a Test artifact that may contain more than one test binaries.
7272
"""
@@ -136,7 +136,7 @@ def add_binary(self, path, binary_type, compare_log=None):
136136
compare_log)
137137

138138

139-
class TestBuild:
139+
class TestBuild(object):
140140
"""
141141
class for Test build.
142142
"""
@@ -245,7 +245,7 @@ def add_test(self, name, test):
245245
self.__tests[name] = test
246246

247247

248-
class TestSpec:
248+
class TestSpec(object):
249249
"""
250250
Test specification. Contains Builds.
251251
"""
@@ -275,7 +275,7 @@ def load(self, test_spec_filename):
275275
with open(test_spec_filename, "r") as f:
276276
self.parse(json.load(f))
277277
except Exception as e:
278-
print("TestSpec::load('%s')" % test_spec_filename, str(e))
278+
print("TestSpec::load('%s') %s" % (test_spec_filename, str(e)))
279279
return False
280280

281281
self.test_spec_filename = test_spec_filename

0 commit comments

Comments
 (0)