Fix unittest failures with python 2.7
authorGuido Trotter <ultrotter@google.com>
Wed, 19 Oct 2011 17:05:22 +0000 (18:05 +0100)
committerGuido Trotter <ultrotter@google.com>
Thu, 20 Oct 2011 08:58:18 +0000 (08:58 +0000)
commitd6f8db249b3a7ab234b9bd676b92862b87df51e3
tree40327c5a6fb01c80218f911029566e2651189f05
parent8b8f54dd3c7c1d047effdee6dcf1b2e595986809
Fix unittest failures with python 2.7

In python 2.7 the ovf unittests fail because OVFReader expects
ElementTree.parse() of an erroneous document to throw an
xml.parsers.expat.ExpatError while instead it throws an
ElementTree.ParseError.

The solution is to "except" for both errors, with the catch that
ParseError didn't exist before, so we need to define it locally and
get it from the module if it exists, while leaving it set to "None"
(thus catching no exception) if it does not.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Agata Murawska  <agatamurawska@google.com>
lib/ovf.py