diff options
author | Matt Riedemann <mriedem.os@gmail.com> | 2018-05-16 11:28:41 -0400 |
---|---|---|
committer | Matt Riedemann <mriedem.os@gmail.com> | 2018-05-16 11:40:41 -0400 |
commit | 9f48aee9b0ea68f7c8eba6a1f3d076e4194d804d (patch) | |
tree | 14e4d8ceeeb87bd1d955a39d3fea4ee63a2a1e9e /nova/tests/unit/test_utils.py | |
parent | 3693caa54132ef3ec278d846dc50943a8d52509b (diff) | |
download | nova-9f48aee9b0ea68f7c8eba6a1f3d076e4194d804d.tar.gz |
Remove deprecated monkey_patch config options
These were deprecated in Queens:
Id793ac2c5cdc5dc473f95eac53b77617a1e389da
And can now be removed.
Change-Id: I27518d1154ec09c57700905bc58ae6a3ce1d8049
Diffstat (limited to 'nova/tests/unit/test_utils.py')
-rw-r--r-- | nova/tests/unit/test_utils.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/nova/tests/unit/test_utils.py b/nova/tests/unit/test_utils.py index 82b59ceef1..d45078662b 100644 --- a/nova/tests/unit/test_utils.py +++ b/nova/tests/unit/test_utils.py @@ -14,7 +14,6 @@ import datetime import hashlib -import importlib import os import os.path import tempfile @@ -36,7 +35,6 @@ from oslo_utils import fixture as utils_fixture from oslo_utils import units import six -import nova from nova import context from nova import exception from nova.objects import base as obj_base @@ -457,74 +455,6 @@ Exit code: -2''') mock.call(['a', '1'], None)]) -class MonkeyPatchTestCase(test.NoDBTestCase): - """Unit test for utils.monkey_patch().""" - def setUp(self): - super(MonkeyPatchTestCase, self).setUp() - self.example_package = 'nova.tests.unit.monkey_patch_example.' - self.flags( - monkey_patch=True, - monkey_patch_modules=[self.example_package + 'example_a' + ':' - + self.example_package + 'example_decorator']) - - def test_monkey_patch(self): - utils.monkey_patch() - nova.tests.unit.monkey_patch_example.CALLED_FUNCTION = [] - from nova.tests.unit.monkey_patch_example import example_a - from nova.tests.unit.monkey_patch_example import example_b - - self.assertEqual('Example function', example_a.example_function_a()) - exampleA = example_a.ExampleClassA() - exampleA.example_method() - ret_a = exampleA.example_method_add(3, 5) - self.assertEqual(ret_a, 8) - - self.assertEqual('Example function', example_b.example_function_b()) - exampleB = example_b.ExampleClassB() - exampleB.example_method() - ret_b = exampleB.example_method_add(3, 5) - - self.assertEqual(ret_b, 8) - package_a = self.example_package + 'example_a.' - self.assertIn(package_a + 'example_function_a', - nova.tests.unit.monkey_patch_example.CALLED_FUNCTION) - - self.assertIn(package_a + 'ExampleClassA.example_method', - nova.tests.unit.monkey_patch_example.CALLED_FUNCTION) - self.assertIn(package_a + 'ExampleClassA.example_method_add', - nova.tests.unit.monkey_patch_example.CALLED_FUNCTION) - package_b = self.example_package + 'example_b.' - self.assertNotIn(package_b + 'example_function_b', - nova.tests.unit.monkey_patch_example.CALLED_FUNCTION) - self.assertNotIn(package_b + 'ExampleClassB.example_method', - nova.tests.unit.monkey_patch_example.CALLED_FUNCTION) - self.assertNotIn(package_b + 'ExampleClassB.example_method_add', - nova.tests.unit.monkey_patch_example.CALLED_FUNCTION) - - -class MonkeyPatchDefaultTestCase(test.NoDBTestCase): - """Unit test for default monkey_patch_modules value.""" - - def setUp(self): - super(MonkeyPatchDefaultTestCase, self).setUp() - self.flags( - monkey_patch=True) - - def test_monkey_patch_default_mod(self): - # monkey_patch_modules is defined to be - # <module_to_patch>:<decorator_to_patch_with> - # Here we check that both parts of the default values are - # valid - for module in CONF.monkey_patch_modules: - m = module.split(':', 1) - # Check we can import the module to be patched - importlib.import_module(m[0]) - # check the decorator is valid - decorator_name = m[1].rsplit('.', 1) - decorator_module = importlib.import_module(decorator_name[0]) - getattr(decorator_module, decorator_name[1]) - - class AuditPeriodTest(test.NoDBTestCase): def setUp(self): |