diff options
author | Hervé Beraud <hberaud@redhat.com> | 2022-09-29 09:59:31 +0200 |
---|---|---|
committer | Hervé Beraud <hberaud@redhat.com> | 2022-09-29 09:59:31 +0200 |
commit | 84478d83f87e9993625044de5cd8b4a18dfcaf5d (patch) | |
tree | 03e68fa0abbe954054bcd9d75e1faa3c1ca34d8a | |
parent | c7cb79b40f8c1be270f04a6f650b500ba5343ca4 (diff) | |
download | oslo-config-84478d83f87e9993625044de5cd8b4a18dfcaf5d.tar.gz |
Make tests backward compat with cliff' older versions9.1.0
Change the assertion kind to support all versions of cliff.
The previous related fix 78098e6b18026ff9ef03a948b57348f02d42e13b
was only compatible with cliff>3.4.0.
Change-Id: I7ac27919b0d58929b4c975ebb308f33124a6060f
-rw-r--r-- | oslo_config/tests/test_cfg.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/oslo_config/tests/test_cfg.py b/oslo_config/tests/test_cfg.py index ec2791e..926eb8c 100644 --- a/oslo_config/tests/test_cfg.py +++ b/oslo_config/tests/test_cfg.py @@ -5077,13 +5077,13 @@ class DeprecationWarningTests(DeprecationWarningTestBase): def assert_message_logged(self, deprecated_name, deprecated_group, current_name, current_group): - expected = ('Deprecated: ' + cfg._Namespace._deprecated_opt_message % + expected = (cfg._Namespace._deprecated_opt_message % {'dep_option': deprecated_name, 'dep_group': deprecated_group, 'option': current_name, 'group': current_group} ) - self.assertEqual(expected + '\n', self.log_fixture.output) + self.assertIn(expected + '\n', self.log_fixture.output) def test_deprecated_for_removal(self): self.conf.register_opt(cfg.StrOpt('foo', @@ -5099,10 +5099,10 @@ class DeprecationWarningTests(DeprecationWarningTestBase): self.assertEqual('bar', self.conf.foo) # Options not set in the config should not be logged. self.assertIsNone(self.conf.bar) - expected = ('Deprecated: Option "foo" from group "DEFAULT" is ' + expected = ('Option "foo" from group "DEFAULT" is ' 'deprecated for removal. Its value may be silently ' 'ignored in the future.\n') - self.assertEqual(expected, self.log_fixture.output) + self.assertIn(expected, self.log_fixture.output) def test_deprecated_for_removal_with_group(self): self.conf.register_group(cfg.OptGroup('other')) @@ -5121,10 +5121,10 @@ class DeprecationWarningTests(DeprecationWarningTestBase): self.assertEqual('bar', self.conf.other.foo) # Options not set in the config should not be logged. self.assertIsNone(self.conf.other.bar) - expected = ('Deprecated: Option "foo" from group "other" is ' + expected = ('Option "foo" from group "other" is ' 'deprecated for removal. Its value may be silently ' 'ignored in the future.\n') - self.assertEqual(expected, self.log_fixture.output) + self.assertIn(expected, self.log_fixture.output) def test_deprecated_with_dest(self): self.conf.register_group(cfg.OptGroup('other')) @@ -5138,12 +5138,12 @@ class DeprecationWarningTests(DeprecationWarningTestBase): self.conf(['--config-file', paths[0]]) self.assertEqual('baz', self.conf.other.foo) - expected = ('Deprecated: ' + cfg._Namespace._deprecated_opt_message % + expected = (cfg._Namespace._deprecated_opt_message % {'dep_option': 'bar', 'dep_group': 'other', 'option': 'foo-bar', 'group': 'other'} + '\n') - self.assertEqual(expected, self.log_fixture.output) + self.assertIn(expected, self.log_fixture.output) class DeprecationWarningTestsNoOsloLog(DeprecationWarningTests): |