Changed a regex to use an r string. Added decoding of command pipe output.

- Legacy-Id: 16374
This commit is contained in:
Henrik Levkowetz 2019-07-04 15:45:18 +00:00
parent d460721415
commit 2e92652eaa

View file

@ -80,6 +80,8 @@ class DraftIdnitsChecker(object):
cmd = "%s %s %s" % (settings.IDSUBMIT_IDNITS_BINARY, self.options, path)
code, out, err = pipe(cmd)
out = out.decode()
err = err.decode()
if code != 0 or out == "":
message = "idnits error: %s:\n Error %s: %s" %( cmd, code, err)
log(message)
@ -87,7 +89,7 @@ class DraftIdnitsChecker(object):
else:
message = out
if re.search("\s+Summary:\s+0\s+|No nits found", out):
if re.search(r"\s+Summary:\s+0\s+|No nits found", out):
passed = True
else:
passed = False
@ -204,6 +206,8 @@ class DraftYangChecker(object):
cmd_version = VersionInfo.objects.get(command=command).version
cmd = cmd_template.format(libs=modpath, model=path)
code, out, err = pipe(cmd)
out = out.decode()
err = err.decode()
if code > 0 or len(err.strip()) > 0 :
error_lines = err.splitlines()
assertion('len(error_lines) > 0')
@ -235,6 +239,8 @@ class DraftYangChecker(object):
cmd = cmd_template.format(model=path, rfclib=settings.SUBMIT_YANG_RFC_MODEL_DIR, tmplib=workdir,
draftlib=settings.SUBMIT_YANG_DRAFT_MODEL_DIR, ianalib=settings.SUBMIT_YANG_IANA_MODEL_DIR, )
code, out, err = pipe(cmd)
out = out.decode()
err = err.decode()
if code > 0 or len(err.strip()) > 0:
err_lines = err.splitlines()
for line in err_lines: