Fall back to regular diff in case of malformed xml#7
Fall back to regular diff in case of malformed xml#7anat0lius wants to merge 1 commit intojoh:masterfrom
Conversation
joh
left a comment
There was a problem hiding this comment.
Unless I'm mistaken, with this change we simply ignore errors and fall back to a regular diff of the original files instead. I suppose this is ok, but the user should be presented with a warning when any of the input files are malformed, warning them that the tool falls back to a regular diff...
| tmp1.flush() | ||
| actual = tmp1.name | ||
| except ET.ParseError: | ||
| actual = file1 |
There was a problem hiding this comment.
So in case the XML has errors, we simply fall back to a diff of the original files?
There was a problem hiding this comment.
We could add a warning, indeed, but then it will break the integration with other programs where you don't want or expect other kind of outputs (which is my case). I guess the good way would be to use a logger and pass a parameter to run in silence. An alternative is to just document this (logical) behavior in the README.
| tmp1.flush() | ||
| actual = tmp1.name | ||
| except ET.ParseError: | ||
| actual = file1 |
Avoids crashing when comparing malformed xml files