From c52d34f1b46f88ae2786cfb873f9b12a1a01b629 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Thu, 8 Mar 2018 17:53:16 +0100 Subject: [PATCH] Raise a proper exception in unit test Using the raise statement without parameter outside of an except block is not a valid python constuct. The original intention was to simulate a failure to see if the context manager handles it properly. This patch replaces that invalid statement with a proper exception raise. TrivialFix Change-Id: I3c6fc0ab617796c70bac2a853504f46ae2adb536 Closes-Bug: #1754409 --- nova/tests/unit/compute/test_compute_mgr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/tests/unit/compute/test_compute_mgr.py b/nova/tests/unit/compute/test_compute_mgr.py index 07dd298c9286..a81c04a11e63 100644 --- a/nova/tests/unit/compute/test_compute_mgr.py +++ b/nova/tests/unit/compute/test_compute_mgr.py @@ -5683,7 +5683,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase): with self.compute._build_resources(self.context, self.instance, self.requested_networks, self.security_groups, self.image, self.block_device_mapping): - raise + raise test.TestingException() except Exception as e: self.assertEqual(expected_exc, e) mock_build_network.assert_called_once_with(self.context, self.instance,