def get_tests(args, pkg_path):
 recipes_dir = args.recipes_dir
 tests = []
 input_dir = os.path.dirname(os.path.join(recipes_dir, pkg_path))
 recipe_meta = MetaData(input_dir)
 tests_commands = recipe_meta.get_value('test/commands')
 tests_imports = recipe_meta.get_value('test/imports')
 requirements = recipe_meta.get_value('requirements/run')
 if (tests_imports or tests_commands):
  if tests_commands:
   tests.append(' && '.join(tests_commands))
  if (tests_imports and ('python' in requirements)):
   tests.append(' && '.join((('python -c "import %s"' % imp) for imp in tests_imports)))
  elif (tests_imports and (('perl' in requirements) or ('perl-threaded' in requirements))):
   tests.append(' && '.join((('perl -e "use %s;"' % imp) for imp in tests_imports)))
 tests = ' && '.join(tests)
 tests = tests.replace('$R ', 'Rscript ')
 return tests

def get_tests ( args , pkg_path ) : recipes_dir = args . recipes_dir tests = [ ] input_dir = os . path . dirname ( os . path . join ( recipes_dir , pkg_path ) ) recipe_meta = MetaData ( input_dir ) tests_commands = recipe_meta . get_value ( 'test/commands' ) tests_imports = recipe_meta . get_value ( 'test/imports' ) requirements = recipe_meta . get_value ( 'requirements/run' ) if ( tests_imports or tests_commands ) : if tests_commands : tests . append ( ' && ' . join ( tests_commands ) ) if ( tests_imports and ( 'python' in requirements ) ) : tests . append ( ' && ' . join ( ( ( 'python -c "import %s"' % imp ) for imp in tests_imports ) ) ) elif ( tests_imports and ( ( 'perl' in requirements ) or ( 'perl-threaded' in requirements ) ) ) : tests . append ( ' && ' . join ( ( ( 'perl -e "use %s;"' % imp ) for imp in tests_imports ) ) ) tests = ' && ' . join ( tests ) tests = tests . replace ( '$R ' , 'Rscript ' ) return tests
yield all the tests in the modules found by get_tests_modules .