From e10702127f0c10306e10b1f82b1e5207e8ebaa0a Mon Sep 17 00:00:00 2001 From: SteGut Date: Fri, 4 Mar 2016 13:00:09 +0000 Subject: [PATCH 1/2] Add greentea-client dependency detection --- mbed_greentea/mbed_greentea_cli.py | 13 ++++++++++++- mbed_greentea/mbed_yotta_module_parse.py | 11 +++++++++++ test/mbed_gt_yotta_module.py | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mbed_greentea/mbed_greentea_cli.py b/mbed_greentea/mbed_greentea_cli.py index 7ff5e4bf..c952cf56 100644 --- a/mbed_greentea/mbed_greentea_cli.py +++ b/mbed_greentea/mbed_greentea_cli.py @@ -565,7 +565,18 @@ def main_cli(opts, args, gt_instance_uuid=None): ### Read yotta module basic information yotta_module = YottaModule() yotta_module.init() # Read actual yotta module data - + + # Check if greentea-client is in module.json of repo to test, otherwise abort + if not yotta_module.check_greentea_client(): + gt_logger.gt_log(""" + ***************************************************************************************** + * Please downgrade to Greentea before v0.2.0: pip install mbed-greentea<0.2.0 --upgrade * + * or * + * port your tests to new async model: https://github.com/ARMmbed/greentea/pull/78 * + ***************************************************************************************** + """) + return (0) + ### Selecting yotta targets to process yt_targets = [] # List of yotta targets specified by user used to process during this run if opts.list_of_targets: diff --git a/mbed_greentea/mbed_yotta_module_parse.py b/mbed_greentea/mbed_yotta_module_parse.py index c8d3b805..86f509da 100644 --- a/mbed_greentea/mbed_yotta_module_parse.py +++ b/mbed_greentea/mbed_yotta_module_parse.py @@ -108,3 +108,14 @@ def get_data(self): def get_name(self): return self.__yotta_module.get('name', 'unknown') + + def check_greentea_client(self): + dependencies = self.__yotta_module.get('dependencies', False) + testDependencies = self.__yotta_module.get('testDependencies', False) + if dependencies: + if dependencies.get('greentea-client', False): + return True + if testDependencies: + if testDependencies.get('greentea-client', False): + return True + return False diff --git a/test/mbed_gt_yotta_module.py b/test/mbed_gt_yotta_module.py index f83564ec..b70ea567 100644 --- a/test/mbed_gt_yotta_module.py +++ b/test/mbed_gt_yotta_module.py @@ -65,6 +65,9 @@ def test_get_name(self): def test_get_dict_items(self): self.assertEqual('Simple test harness with unity and greentea integration.', self.yotta_module.get_data().get('description')) self.assertEqual('Apache-2.0', self.yotta_module.get_data().get('license')) + + def test_check_greentea_client(self): + self.assertTrue(self.yotta_module.check_greentea_client()) if __name__ == '__main__': unittest.main() From c17326de002a599640fd91a37a6b6c633ead8e30 Mon Sep 17 00:00:00 2001 From: SteGut Date: Fri, 4 Mar 2016 15:57:17 +0000 Subject: [PATCH 2/2] Edit note regarding greentea version --- mbed_greentea/mbed_greentea_cli.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mbed_greentea/mbed_greentea_cli.py b/mbed_greentea/mbed_greentea_cli.py index c952cf56..91e20e3e 100644 --- a/mbed_greentea/mbed_greentea_cli.py +++ b/mbed_greentea/mbed_greentea_cli.py @@ -566,13 +566,19 @@ def main_cli(opts, args, gt_instance_uuid=None): yotta_module = YottaModule() yotta_module.init() # Read actual yotta module data - # Check if greentea-client is in module.json of repo to test, otherwise abort + # Check if NO greentea-client is in module.json of repo to test, if so abort if not yotta_module.check_greentea_client(): gt_logger.gt_log(""" ***************************************************************************************** - * Please downgrade to Greentea before v0.2.0: pip install mbed-greentea<0.2.0 --upgrade * - * or * - * port your tests to new async model: https://github.com/ARMmbed/greentea/pull/78 * + * We've noticed that NO 'greentea-client' module is specified in * + * dependency/testDependency section of this module's 'module.json' file. * + * * + * This version of Greentea requires 'greentea-client' module. * + * Please downgrade to Greentea before v0.2.0: * + * * + * $ pip install "mbed-greentea<0.2.0" --upgrade * + * * + * or port your tests to new Async model: https://github.com/ARMmbed/greentea/pull/78 * ***************************************************************************************** """) return (0)