- schema_rows_normed += ['\n'.join(row_normed)]
- retrieved_schema = ';\n'.join(schema_rows_normed) + ';'
- stored_schema = _PATH_DB_SCHEMA.read_text(encoding='utf-8').rstrip()
- if stored_schema != retrieved_schema:
- diff_msg = Differ().compare(retrieved_schema.splitlines(),
- stored_schema.splitlines())
- raise HandledException('DB has wrong tables schema. Diff:\n'
- + '\n'.join(diff_msg))
+ row_normed[-1] = row_normed[-1] + ';'
+ schema_rows_normed += row_normed
+ if ((expected_rows :=
+ _PATH_DB_SCHEMA.read_text(encoding='utf8').rstrip().splitlines()
+ ) != schema_rows_normed):
+ raise HandledException(
+ 'Unexpected tables schema. Diff to {_PATH_DB_SCHEMA}:\n' +
+ '\n'.join(Differ().compare(schema_rows_normed, expected_rows)))