diff --git a/mbed_greentea/mbed_greentea_cli.py b/mbed_greentea/mbed_greentea_cli.py index 3529217f..f2e65a00 100644 --- a/mbed_greentea/mbed_greentea_cli.py +++ b/mbed_greentea/mbed_greentea_cli.py @@ -567,7 +567,24 @@ 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 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(""" + ***************************************************************************************** + * 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) + ### 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()