def from_yaml(yaml_file): y = qty.load_yaml(yaml_file) OPTIONS.set_download_url(qty.download_url(y)) global_result = Result.MATCH # TODO: print in subtest format # json_results = {} t_list = qty.traces(y, device_name=OPTIONS.device_name, checksum=True) for t in t_list: result, json_result = _check_trace(t['path'], t['checksum']) if result is not Result.MATCH and global_result is not Result.FAILURE: global_result = result # json_results.update(json_result) # _print_result(result, t['path'], json_result) return global_result
def __init__(self, filename, device_name): try: with open(filename, 'r') as f: self.yaml = qty.load_yaml(f) except FileNotFoundError: raise exceptions.PiglitFatalError( 'Cannot open "{}"'.format(filename)) self.device_name = device_name self.extra_args = ['--device-name', device_name, '--download-url', qty.download_url(self.yaml)] \ + _EXTRA_ARGS self.forced_test_list = [] self.filters = profile.Filters() self.options = { 'dmesg': profile.get_dmesg(False), 'monitor': profile.Monitoring(False), 'ignore_missing': False, }
def test_download_url_basic(yaml, expected): """query_yamls_yaml.download_url: Get download url from some basic YAML with a trace-db entry""" assert expected == qty.download_url(yaml)
def test_download_url_TypeError(yaml): """query_traces_yaml.download_url: Raise TypeError on invalid YAML""" u = qty.download_url(yaml)
def _traces_db_download_url(args): y = qty.load_yaml(args.yaml_file) url = qty.download_url(y) or "" print(url)