diff --git a/app/cocal_methods.py b/app/cocal_methods.py index 365210f4022eddd6d547dd22c7cc002d18257ad0..9e93f0593ffe0aa8df43d0d90959ea762dfd7dd6 100644 --- a/app/cocal_methods.py +++ b/app/cocal_methods.py @@ -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.")