Skip to content

Fixes for Python 3 compatibility #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/mbed-greentea/mbed_greentea/mbed_greentea_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def run_test_thread(test_result_queue, test_queue, opts, mut, build, build_path,
# In some cases we want to print console to see why test failed
# even if we are not in verbose mode
gt_logger.gt_log_tab("test failed, reporting console output (specified with --report-fails option)")
print
print()
print(single_test_output)

#greentea_release_target_id(mut['target_id'], gt_instance_uuid)
Expand Down
5 changes: 2 additions & 3 deletions src/mbed_os_tools/detect/lstools_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
LOCAL_PLATFORM_DATABASE,
LOCAL_MOCKS_DATABASE,
)
from future.utils import with_metaclass

mbedls_root_logger = logging.getLogger("mbedls")
mbedls_root_logger.setLevel(logging.WARNING)
Expand Down Expand Up @@ -56,13 +57,11 @@ class FSInteraction(object):
Never = 3


class MbedLsToolsBase(object):
class MbedLsToolsBase(with_metaclass(ABCMeta, object)):
""" Base class for mbed-lstools, defines mbed-ls tools interface for
mbed-enabled devices detection for various hosts
"""

__metaclass__ = ABCMeta

# Which OSs are supported by this module
# Note: more than one OS can be supported by mbed-lstools_* module
os_supported = []
Expand Down
4 changes: 2 additions & 2 deletions src/mbed_os_tools/test/mbed_greentea_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"""


class GreenteaTestHook():
class GreenteaTestHook(object):
"""! Class used to define
"""
name = None
Expand Down Expand Up @@ -204,7 +204,7 @@ def check_if_file_exists_or_is_empty(expr):
result = result.replace('>>', '')
return result

class GreenteaHooks():
class GreenteaHooks(object):
"""! Class used to store all hooks
@details Hooks command starts with '$' dollar sign
"""
Expand Down
2 changes: 1 addition & 1 deletion src/mbed_os_tools/test/mbed_greentea_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
COLORAMA = False


class GreenTeaSimpleLockLogger:
class GreenTeaSimpleLockLogger(object):
"""! Simple locking printing mechanism
@details We are using parallel testing
"""
Expand Down
2 changes: 1 addition & 1 deletion src/mbed_os_tools/test/mbed_report_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def export_to_file(file_name, payload):
with open(file_name, 'w') as f:
f.write(payload)
except IOError as e:
print("Exporting report to file failed: ", str(e))
print("Exporting report to file failed: %s" % str(e))
result = False
return result

Expand Down
6 changes: 3 additions & 3 deletions src/mbed_os_tools/test/mbed_yotta_module_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import json


class YottaConfig():
class YottaConfig(object):

yotta_config = None

Expand Down Expand Up @@ -75,7 +75,7 @@ def get_test_pins(self):
return None


class YottaModule():
class YottaModule(object):

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

def set_yotta_module(self, yotta_module):
Expand Down
10 changes: 5 additions & 5 deletions src/mbed_os_tools/test/tests_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import json


class TestBinary:
class TestBinary(object):
"""
Class representing a Test Binary.
"""
Expand Down Expand Up @@ -66,7 +66,7 @@ def get_compare_log(self):
return self.__comp_log


class Test:
class Test(object):
"""
class representing a Test artifact that may contain more than one test binaries.
"""
Expand Down Expand Up @@ -136,7 +136,7 @@ def add_binary(self, path, binary_type, compare_log=None):
compare_log)


class TestBuild:
class TestBuild(object):
"""
class for Test build.
"""
Expand Down Expand Up @@ -245,7 +245,7 @@ def add_test(self, name, test):
self.__tests[name] = test


class TestSpec:
class TestSpec(object):
"""
Test specification. Contains Builds.
"""
Expand Down Expand Up @@ -275,7 +275,7 @@ def load(self, test_spec_filename):
with open(test_spec_filename, "r") as f:
self.parse(json.load(f))
except Exception as e:
print("TestSpec::load('%s')" % test_spec_filename, str(e))
print("TestSpec::load('%s') %s" % (test_spec_filename, str(e)))
return False

self.test_spec_filename = test_spec_filename
Expand Down