Skip to content
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

Add greentea-client dependency detection #93

Merged
merged 2 commits into from
Mar 4, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion mbed_greentea/mbed_greentea_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to more verbose:

gt_logger.gt_log("""
*****************************************************************************************
* We've noticed that 'greentea-client' module is specified in dependency/testDependency *
* section of this module's 'module.json' file.                                          *
*                                                                                       *
* This version of Greentea doesn't support '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    *
*****************************************************************************************
""")

*****************************************************************************************
* 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:
Expand Down
11 changes: 11 additions & 0 deletions mbed_greentea/mbed_yotta_module_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions test/mbed_gt_yotta_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()