def test_manifest_write():
    with tempfile.TemporaryDirectory() as tmpd:
        manifest = Manifest(
            os.path.join(test_data, 'file_set_good', 'files_good.tsv'))
        manifest.validate()
        (tsv_file, json_file) = manifest.write(
            tmpd)  # output new manifest in tsv and json.
예제 #2
0
    '-i',
    '--input',
    dest='input',
    metavar='FILE',
    help='Input manifest in tsv formats',
    required=True,
    type=lambda s: cliutil.extn_check(parser, ('tsv'), s, readable=True))
parser.add_argument('-o',
                    '--output',
                    dest='output',
                    metavar='DIR',
                    help='Output manifest to this area, two files (tsv, json)',
                    required=True)
parser.add_argument('-c',
                    '--checkfiles',
                    dest='checkfiles',
                    action='store_true',
                    help='When present check file exist and are non-zero size')

args = parser.parse_args()

try:
    manifest = Manifest(args.input)
    manifest.validate()
    (tsv_file, json_file) = manifest.write(
        args.output)  # output new manifest in tsv and json.
    print("Created files:\n\t%s\n\t%s" % (tsv_file, json_file))
except ValidationError as ve:
    print("ERROR: " + str(ve), file=sys.stderr)
    exit(1)