diff options
author | Julien Danjou <julien@danjou.info> | 2013-07-16 11:49:04 +0200 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2013-07-16 17:41:38 +0200 |
commit | 305ecd817836a90a8f5e495cbf6a770dcea1f7e8 (patch) | |
tree | c194979b6a2beced6037ef4d78732f418be0ec66 /tests/test_cfg.py | |
parent | b96ebd3e5d958d3bf52508a0df5fcc77daa4bdf5 (diff) | |
download | oslo-config-305ecd817836a90a8f5e495cbf6a770dcea1f7e8.tar.gz |
Add Python 3 support
These are the final changes needed to have the full py33 tox environment
running and passing all tests.
Change-Id: I3ac149345561a5bb99e017022ba2e2be10154584
Diffstat (limited to 'tests/test_cfg.py')
-rw-r--r-- | tests/test_cfg.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test_cfg.py b/tests/test_cfg.py index b75f4bc..8f801c7 100644 --- a/tests/test_cfg.py +++ b/tests/test_cfg.py @@ -23,6 +23,7 @@ import fixtures import testscenarios from oslo.config import cfg +import six from six import moves from tests import utils @@ -2155,7 +2156,8 @@ class SadPathTestCase(BaseTestCase): def test_unknown_attr(self): self.conf([]) self.assertFalse(hasattr(self.conf, 'foo')) - self.assertRaises(cfg.NoSuchOptError, getattr, self.conf, 'foo') + self.assertRaises(AttributeError, getattr, self.conf, 'foo') + self.assertRaises(cfg.NoSuchOptError, self.conf._get, 'foo') def test_unknown_attr_is_attr_error(self): self.conf([]) @@ -2257,7 +2259,8 @@ class SadPathTestCase(BaseTestCase): self.conf(['--config-file', paths[0]]) - self.assertRaises(cfg.ConfigFileValueError, getattr, self.conf, 'foo') + self.assertRaises(AttributeError, getattr, self.conf, 'foo') + self.assertRaises(cfg.ConfigFileValueError, self.conf._get, 'foo') def test_conf_file_bad_bool(self): self._do_test_conf_file_bad_value(cfg.BoolOpt) @@ -2277,7 +2280,9 @@ class SadPathTestCase(BaseTestCase): self.assertFalse(hasattr(self.conf, 'bar')) self.assertRaises( - cfg.TemplateSubstitutionError, getattr, self.conf, 'bar') + AttributeError, getattr, self.conf, 'bar') + self.assertRaises( + cfg.TemplateSubstitutionError, self.conf._get, 'bar') def test_set_default_unknown_attr(self): self.conf([]) @@ -2438,7 +2443,7 @@ class ConfigParserTestCase(BaseTestCase): def test_no_section(self): with tempfile.NamedTemporaryFile() as tmpfile: - tmpfile.write('foo = bar') + tmpfile.write(six.b('foo = bar')) tmpfile.flush() parser = cfg.ConfigParser(tmpfile.name, {}) @@ -2812,7 +2817,8 @@ class ChoicesTestCase(BaseTestCase): self.conf(['--config-file', paths[0]]) - self.assertRaises(cfg.ConfigFileValueError, getattr, self.conf, 'foo') + self.assertRaises(cfg.ConfigFileValueError, self.conf._get, 'foo') + self.assertRaises(AttributeError, getattr, self.conf, 'foo') def test_conf_file_choice_value_override(self): self.conf.register_cli_opt(cfg.StrOpt('foo', |