Skip to content

Commit

Permalink
Merge pull request #93 from stegut01/issue_84
Browse files Browse the repository at this point in the history
Add greentea-client dependency detection
  • Loading branch information
PrzemekWirkus committed Mar 4, 2016
2 parents c47e293 + c17326d commit 9260c42
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
19 changes: 18 additions & 1 deletion mbed_greentea/mbed_greentea_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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()

0 comments on commit 9260c42

Please sign in to comment.