diff --git a/oslo_utils/fixture.py b/oslo_utils/fixture.py index 912d81bd..6a874de3 100644 --- a/oslo_utils/fixture.py +++ b/oslo_utils/fixture.py @@ -79,7 +79,7 @@ class _UUIDSentinels(object): def __getattr__(self, name): if name.startswith('_'): - raise ValueError('Sentinels must not start with _') + raise AttributeError('Sentinels must not start with _') with self._lock: if name not in self._sentinels: self._sentinels[name] = uuidutils.generate_uuid() diff --git a/oslo_utils/tests/test_fixture.py b/oslo_utils/tests/test_fixture.py index dafac2f3..5775136d 100644 --- a/oslo_utils/tests/test_fixture.py +++ b/oslo_utils/tests/test_fixture.py @@ -80,5 +80,5 @@ class UUIDSentinelsTest(test_base.BaseTestCase): self.assertIsInstance(uuids.foo, str) def test_with_underline_prefix(self): - ex = self.assertRaises(ValueError, getattr, uuids, '_foo') + ex = self.assertRaises(AttributeError, getattr, uuids, '_foo') self.assertIn("Sentinels must not start with _", six.text_type(ex))