From ec28a1ae4d16d4b54aae9ed9ae643308f193758e Mon Sep 17 00:00:00 2001 From: Marco Biasini <marco.biasini@unibas.ch> Date: Fri, 8 Mar 2013 17:43:37 +0100 Subject: [PATCH] fix geom unit tests for old version of Boost.Python On some old versions of Boost.Python, std::out_of_range is not properly converted to IndexError. Instead, a RuntimeError is raised. For these versions, we overwrite the IndexError type with the type of the exception raised by geom.Vec2()[3]. --- modules/geom/tests/test_geom.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/geom/tests/test_geom.py b/modules/geom/tests/test_geom.py index 60a989ac4..46063eb4f 100644 --- a/modules/geom/tests/test_geom.py +++ b/modules/geom/tests/test_geom.py @@ -26,6 +26,14 @@ if __name__== '__main__': import ost import ost.geom as geom +# this terrible hack is required for older version of Python/Boost +# which do not convert std::out_of_range to IndexError correctly. +try: + geom.Vec2()[3] +except Exception, e: + pass + IndexError = type(e) + class TestGeom(unittest.TestCase): def runTest(self): self.test_repr() -- GitLab