def get_test_packages():
 all_packages = get_package_directories()
 local_diff = local_diff_branch()
 parser = get_parser()
 args = parser.parse_args()
 if (args.packages is not UNSET_SENTINEL):
  verify_packages(args.packages, all_packages)
  return sorted(args.packages)
 elif (local_diff is not None):
  changed_packages = get_changed_packages('HEAD', local_diff, all_packages)
  return follow_dependencies(changed_packages, all_packages)
 elif in_travis():
  changed_packages = get_travis_directories(all_packages)
  return follow_dependencies(changed_packages, all_packages)
 else:
  return all_packages

def get_test_packages ( ) : all_packages = get_package_directories ( ) local_diff = local_diff_branch ( ) parser = get_parser ( ) args = parser . parse_args ( ) if ( args . packages is not UNSET_SENTINEL ) : verify_packages ( args . packages , all_packages ) return sorted ( args . packages ) elif ( local_diff is not None ) : changed_packages = get_changed_packages ( 'HEAD' , local_diff , all_packages ) return follow_dependencies ( changed_packages , all_packages ) elif in_travis ( ) : changed_packages = get_travis_directories ( all_packages ) return follow_dependencies ( changed_packages , all_packages ) else : return all_packages
get a list of packages which need tests run .