Skip to content
Snippets Groups Projects
Commit 152eab4b authored by user's avatar user
Browse files

include switch for dcc validation

parent d193c01e
Branches
No related tags found
No related merge requests found
......@@ -156,13 +156,13 @@ class CocalMethods:
soundfile.close()
def upload_is_ready(self):
# return self.dut_path.exists()
return True
return self.dut_path.exists()
# return True
def wait_for_user_upload(self, timeout=10):
start = time.time()
while not self.upload_is_ready():
time.wait(1)
time.sleep(1)
if time.time() - start > timeout:
break
return self.upload_is_ready()
......@@ -313,7 +313,7 @@ class CocalMethods:
return filter_tree
def generate_dcc(self):
def generate_dcc(self, perform_dcc_validation=False):
if self.transfer_behavior:
placeholder_dict = {
"PLACEHOLDER_GIT_HASH": self.get_current_git_hash(),
......@@ -344,14 +344,15 @@ class CocalMethods:
ET.indent(tree)
tree.write(self.dcc_path, encoding="UTF-8", pretty_print=True, )
# validate against schema
dcc_schema_path = os.path.abspath(r"app/dcc/dcc.xsd")
try:
schema = xmlschema.XMLSchema(dcc_schema_path, validation="lax") # strict (default) requires internet connection
result = schema.validate(self.dcc_path)
print(result)
except Exception as e:
print(f"Schema did not validate successfully. (Error: {e})")
# validate against schema (requires internet connection)
if perform_dcc_validation:
dcc_schema_path = os.path.abspath(r"app/dcc/dcc.xsd")
try:
schema = xmlschema.XMLSchema(dcc_schema_path)
result = schema.validate(self.dcc_path)
print(result)
except Exception as e:
print(f"Schema did not validate successfully. (Error: {e})")
else:
print("Can't generate DCC. No transfer behavior available.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment