Skip to content

Commit

Permalink
Update validate to execute on every file individually
Browse files Browse the repository at this point in the history
Per [this new requirement implemented in validate](NASA-PDS/validate#755), having many labels point to the same data file will cause validate to fail.

When we are testing with LDDs, we don't care about that, so let's validate each file individually.
  • Loading branch information
jordanpadams authored Dec 19, 2023
1 parent 39b3244 commit 35f2784
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/pds/ldd_manager/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,26 @@ def exec_validate(executable, args, data_path, pds4_version, failure_expected=Fa
if not files:
continue

validate_args = args.copy()
validate_args.append('-t')
validate_args.extend(files)

cmd = ['bash', executable]
cmd.extend(validate_args)
with Popen(cmd, stdout=PIPE, stderr=STDOUT, bufsize=1, universal_newlines=True) as p:
with open(log_out, 'w') as f:
for line in p.stdout:
print(line, end='') # process line here
f.write(line)

success = False
if p.returncode != 0 and key == "fail":
success = True
elif p.returncode == 0 and key == "valid":
success = True
else:
raise CalledProcessError(p.returncode, p.args)
for file in files:
validate_args = args.copy()
validate_args.append('-t')
validate_args.extend(files)

cmd = ['bash', executable]
cmd.extend(validate_args)
with Popen(cmd, stdout=PIPE, stderr=STDOUT, bufsize=1, universal_newlines=True) as p:
with open(log_out, 'w') as f:
for line in p.stdout:
print(line, end='') # process line here
f.write(line)

success = False
if p.returncode != 0 and key == "fail":
success = True
elif p.returncode == 0 and key == "valid":
success = True
else:
raise CalledProcessError(p.returncode, p.args)

return success

Expand Down

0 comments on commit 35f2784

Please sign in to comment.