A lot of assertions are used in Ganeti's code. Some unittests even check whether AssertionError is raised in some cases. Explicitely ensuring assertions are evaluated makes sure those tests don't fail and assertions are checked.
Signed-off-by: Michael Hanselmann <[email protected]> --- test/testutils.py | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/test/testutils.py b/test/testutils.py index fd95c76..fd4655a 100644 --- a/test/testutils.py +++ b/test/testutils.py @@ -45,6 +45,19 @@ class GanetiTestProgram(unittest.TestProgram): sys.stderr.write("Running %s\n" % self.progName) sys.stderr.flush() + # Ensure assertions will be evaluated + if not __debug__: + raise Exception("Not running in debug mode, assertions would not be" + " evaluated") + + # Check again, this time with a real assertion + try: + assert False + except AssertionError: + pass + else: + raise Exception("Assertion not evaluated") + return unittest.TestProgram.runTests(self) -- 1.7.0.4
