Drop use of 'oslo' namespace package

The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: I029c3260051aa48cfaae428c096c1ac7b43b2bd2
This commit is contained in:
Doug Hellmann 2015-07-16 17:46:49 +00:00
parent cf9cb86be7
commit 3d6e396d8c

View File

@ -59,7 +59,7 @@ class FakeRequest(object):
self.environ = environ self.environ = environ
@mock.patch('oslo.messaging.get_transport', mock.MagicMock()) @mock.patch('oslo_messaging.get_transport', mock.MagicMock())
class TestSwift(tests_base.TestCase): class TestSwift(tests_base.TestCase):
def setUp(self): def setUp(self):
@ -75,7 +75,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(), {}) app = swift.Swift(FakeApp(), {})
req = FakeRequest('/1.0/account/container/obj', req = FakeRequest('/1.0/account/container/obj',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
resp = app(req.environ, self.start_response) resp = app(req.environ, self.start_response)
self.assertEqual(["This string is 28 bytes long"], list(resp)) self.assertEqual(["This string is 28 bytes long"], list(resp))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
@ -97,7 +97,7 @@ class TestSwift(tests_base.TestCase):
environ={'REQUEST_METHOD': 'PUT', environ={'REQUEST_METHOD': 'PUT',
'wsgi.input': 'wsgi.input':
six.moves.cStringIO('some stuff')}) six.moves.cStringIO('some stuff')})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -117,7 +117,7 @@ class TestSwift(tests_base.TestCase):
'/1.0/account/container/obj', '/1.0/account/container/obj',
environ={'REQUEST_METHOD': 'POST', environ={'REQUEST_METHOD': 'POST',
'wsgi.input': six.moves.cStringIO('some other stuff')}) 'wsgi.input': six.moves.cStringIO('some other stuff')})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -135,7 +135,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(body=['']), {}) app = swift.Swift(FakeApp(body=['']), {})
req = FakeRequest('/1.0/account/container/obj', req = FakeRequest('/1.0/account/container/obj',
environ={'REQUEST_METHOD': 'HEAD'}) environ={'REQUEST_METHOD': 'HEAD'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -152,7 +152,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(body=['']), {}) app = swift.Swift(FakeApp(body=['']), {})
req = FakeRequest('/1.0/account/container/obj', req = FakeRequest('/1.0/account/container/obj',
environ={'REQUEST_METHOD': 'BOGUS'}) environ={'REQUEST_METHOD': 'BOGUS'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -168,7 +168,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(), {}) app = swift.Swift(FakeApp(), {})
req = FakeRequest('/1.0/account/container', req = FakeRequest('/1.0/account/container',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -186,7 +186,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(), {}) app = swift.Swift(FakeApp(), {})
req = FakeRequest('/1.0/account/container', req = FakeRequest('/1.0/account/container',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -209,7 +209,7 @@ class TestSwift(tests_base.TestCase):
headers={'X_VAR1': 'value1', headers={'X_VAR1': 'value1',
'X_VAR2': 'value2', 'X_VAR2': 'value2',
'TOKEN': 'token'}) 'TOKEN': 'token'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -235,7 +235,7 @@ class TestSwift(tests_base.TestCase):
req = FakeRequest('/1.0/account/container', req = FakeRequest('/1.0/account/container',
environ={'REQUEST_METHOD': 'GET'}, environ={'REQUEST_METHOD': 'GET'},
headers={'UNICODE': uni}) headers={'UNICODE': uni})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -257,7 +257,7 @@ class TestSwift(tests_base.TestCase):
}) })
req = FakeRequest('/1.0/account/container', req = FakeRequest('/1.0/account/container',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -275,14 +275,14 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(), {}) app = swift.Swift(FakeApp(), {})
req = FakeRequest('/5.0//', req = FakeRequest('/5.0//',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(0, len(notify.call_args_list)) self.assertEqual(0, len(notify.call_args_list))
def test_missing_resource_id(self): def test_missing_resource_id(self):
app = swift.Swift(FakeApp(), {}) app = swift.Swift(FakeApp(), {})
req = FakeRequest('/v1/', environ={'REQUEST_METHOD': 'GET'}) req = FakeRequest('/v1/', environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(0, len(notify.call_args_list)) self.assertEqual(0, len(notify.call_args_list))
@ -292,7 +292,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(body=["test"]), {}) app = swift.Swift(FakeApp(body=["test"]), {})
req = FakeRequest('/1.0/account/container', req = FakeRequest('/1.0/account/container',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
resp = list(app(req.environ, self.start_response)) resp = list(app(req.environ, self.start_response))
self.assertEqual(0, len(notify.call_args_list)) self.assertEqual(0, len(notify.call_args_list))
self.assertEqual(["test"], resp) self.assertEqual(["test"], resp)
@ -301,7 +301,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(), {}) app = swift.Swift(FakeApp(), {})
req = FakeRequest('/1.0/AUTH_account/container/obj', req = FakeRequest('/1.0/AUTH_account/container/obj',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -311,7 +311,7 @@ class TestSwift(tests_base.TestCase):
app = swift.Swift(FakeApp(), {'reseller_prefix': 'CUSTOM_'}) app = swift.Swift(FakeApp(), {'reseller_prefix': 'CUSTOM_'})
req = FakeRequest('/1.0/CUSTOM_account/container/obj', req = FakeRequest('/1.0/CUSTOM_account/container/obj',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -323,7 +323,7 @@ class TestSwift(tests_base.TestCase):
FakeApp(), {'reseller_prefix': 'CUSTOM'}) FakeApp(), {'reseller_prefix': 'CUSTOM'})
req = FakeRequest('/1.0/CUSTOM_account/container/obj', req = FakeRequest('/1.0/CUSTOM_account/container/obj',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(1, len(notify.call_args_list)) self.assertEqual(1, len(notify.call_args_list))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
@ -338,7 +338,7 @@ class TestSwift(tests_base.TestCase):
req = FakeRequest('/1.0/CUSTOM_account/container/obj', req = FakeRequest('/1.0/CUSTOM_account/container/obj',
environ={'REQUEST_METHOD': 'GET', environ={'REQUEST_METHOD': 'GET',
proj_attr: proj}) proj_attr: proj})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(calls, len(notify.call_args_list)) self.assertEqual(calls, len(notify.call_args_list))
@ -352,7 +352,7 @@ class TestSwift(tests_base.TestCase):
req = FakeRequest('/1.0/CUSTOM_account/container/obj', req = FakeRequest('/1.0/CUSTOM_account/container/obj',
environ={'REQUEST_METHOD': 'GET', environ={'REQUEST_METHOD': 'GET',
proj_attr: proj}) proj_attr: proj})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
self.assertEqual(calls, len(notify.call_args_list)) self.assertEqual(calls, len(notify.call_args_list))
@ -361,7 +361,7 @@ class TestSwift(tests_base.TestCase):
FakeApp(), {'reseller_prefix': 'CUSTOM'}) FakeApp(), {'reseller_prefix': 'CUSTOM'})
req = FakeRequest('/1.0/CUSTOM/container/obj', req = FakeRequest('/1.0/CUSTOM/container/obj',
environ={'REQUEST_METHOD': 'GET'}) environ={'REQUEST_METHOD': 'GET'})
with mock.patch('oslo.messaging.Notifier.info') as notify: with mock.patch('oslo_messaging.Notifier.info') as notify:
list(app(req.environ, self.start_response)) list(app(req.environ, self.start_response))
data = notify.call_args_list[0][0] data = notify.call_args_list[0][0]
self.assertIsNot(0, len(data[2]['target']['id'])) self.assertIsNot(0, len(data[2]['target']['id']))