From 8813ab185d0b6ad1c111e7f9e346e2ce91c8113b Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Sat, 3 Mar 2012 17:53:41 +0000 Subject: assertRaises(Exception, ...) considered harmful Expecting that Exception is raised can end up passing an a test when an unexpected error occurs. For instance, errors in the unit test itself can be masked: https://review.openstack.org/4848 https://review.openstack.org/4873 https://review.openstack.org/4874 Change a variety of unit tests to expect a more specific exception so we don't run into false positive tests in the future. Change-Id: Ibc0c63b1f6b5574a3ce93d9f02c9d1ff5ac4a8b0 --- nova/test.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/test.py') diff --git a/nova/test.py b/nova/test.py index db0bb7d24..b38de5303 100644 --- a/nova/test.py +++ b/nova/test.py @@ -115,6 +115,10 @@ def skip_if_fake(func): return _skipper +class TestingException(Exception): + pass + + class TestCase(unittest.TestCase): """Test case base class for all unit tests.""" -- cgit