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
This commit is contained in:
		| @@ -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.""" | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Johannes Erdfelt
					Johannes Erdfelt