MCPcopy Index your code
hub / github.com/tensorflow/datasets / check_output

Function check_output

tensorflow_datasets/testing/test_utils.py:596–607  ·  view source on GitHub ↗

Mock subprocess.check_output for download call.

(command_args, encoding=None)

Source from the content-addressed store, hash-verified

594 """
595
596 def check_output(command_args, encoding=None):
597 """Mock subprocess.check_output for download call."""
598 assert encoding
599 assert command_args[2] == 'download'
600 competition_or_dataset = command_args[-1]
601 if err_msg:
602 raise subprocess.CalledProcessError(1, command_args, err_msg)
603 out_dir = command_args[command_args.index('--path') + 1]
604 fpath = os.path.join(out_dir, 'output.txt')
605 with tf.io.gfile.GFile(fpath, 'w') as f:
606 f.write(competition_or_dataset)
607 return 'Downloading {} to {}'.format(competition_or_dataset, fpath)
608
609 with mock.patch('subprocess.check_output', check_output):
610 yield

Callers

nothing calls this directly

Calls 2

joinMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected