diff --git a/glance/client.py b/glance/client.py index df150f0365..af58cd533d 100644 --- a/glance/client.py +++ b/glance/client.py @@ -44,7 +44,6 @@ class V1Client(base_client.BaseClient): :param use_ssl: Should we use HTTPS? (defaults to False) :param doc_root: Prefix for all URLs we request from host """ - port = port or self.DEFAULT_PORT self.doc_root = doc_root super(Client, self).__init__(host, port, use_ssl) @@ -81,7 +80,6 @@ class V1Client(base_client.BaseClient): :param sort_key: results will be ordered by this image attribute :param sort_dir: direction in which to to order results (asc, desc) """ - params = self._extract_params(kwargs, v1_images.SUPPORTED_PARAMS) res = self.do_request("GET", "/images/detail", params=params) data = json.loads(res.read())['images'] @@ -126,7 +124,6 @@ class V1Client(base_client.BaseClient): :retval The newly-stored image's metadata. """ - headers = utils.image_meta_to_http_headers(image_meta or {}) if image_data: diff --git a/glance/registry/client.py b/glance/registry/client.py index ff84f8b143..3947c624b6 100644 --- a/glance/registry/client.py +++ b/glance/registry/client.py @@ -41,7 +41,6 @@ class RegistryClient(BaseClient): :param port: The port where Glance resides (defaults to 9191) :param use_ssl: Should we use HTTPS? (defaults to False) """ - port = port or self.DEFAULT_PORT super(RegistryClient, self).__init__(host, port, use_ssl) diff --git a/glance/registry/db/api.py b/glance/registry/db/api.py index cae03a0111..e13bd64781 100644 --- a/glance/registry/db/api.py +++ b/glance/registry/db/api.py @@ -97,10 +97,10 @@ def image_create(context, values): def image_update(context, image_id, values, purge_props=False): - """Set the given properties on an image and update it. - - Raises NotFound if image does not exist. + """ + Set the given properties on an image and update it. + :raises NotFound if image does not exist. """ return _image_update(context, values, image_id, purge_props) @@ -131,7 +131,8 @@ def image_get(context, image_id, session=None): def image_get_all_public(context, filters=None, marker=None, limit=None, sort_key='created_at', sort_dir='desc'): - """Get all public images that match zero or more filters. + """ + Get all public images that match zero or more filters. :param filters: dict of filter keys and values. If a 'properties' key is present, it is treated as a dict of key/value @@ -189,7 +190,8 @@ def image_get_all_public(context, filters=None, marker=None, limit=None, def _drop_protected_attrs(model_class, values): - """Removed protected attributes from values dictionary using the models + """ + Removed protected attributes from values dictionary using the models __protected_attributes__ field. """ for attr in model_class.__protected_attributes__: @@ -204,7 +206,6 @@ def validate_image(values): :param values: Mapping of image metadata to check """ - status = values.get('status') disk_format = values.get('disk_format') container_format = values.get('container_format') @@ -237,13 +238,13 @@ def validate_image(values): def _image_update(context, values, image_id, purge_props=False): - """Used internally by image_create and image_update + """ + Used internally by image_create and image_update :param context: Request context :param values: A dict of attributes to set :param image_id: If None, create the image, otherwise, find and update it """ - session = get_session() with session.begin(): @@ -325,7 +326,8 @@ def image_property_update(context, prop_ref, values, session=None): def _image_property_update(context, prop_ref, values, session=None): - """Used internally by image_property_create and image_property_update + """ + Used internally by image_property_create and image_property_update """ _drop_protected_attrs(models.ImageProperty, values) values["deleted"] = False @@ -335,7 +337,8 @@ def _image_property_update(context, prop_ref, values, session=None): def image_property_delete(context, prop_ref, session=None): - """Used internally by image_property_create and image_property_update + """ + Used internally by image_property_create and image_property_update """ prop_ref.update(dict(deleted=True)) prop_ref.save(session=session) @@ -344,8 +347,8 @@ def image_property_delete(context, prop_ref, session=None): # pylint: disable-msg=C0111 def _deleted(context): - """Calculates whether to include deleted objects based on context. - + """ + Calculates whether to include deleted objects based on context. Currently just looks for a flag called deleted in the context dict. """ if not hasattr(context, 'get'): diff --git a/glance/registry/db/migrate_repo/schema.py b/glance/registry/db/migrate_repo/schema.py index 202eceb782..4d5c6adad0 100644 --- a/glance/registry/db/migrate_repo/schema.py +++ b/glance/registry/db/migrate_repo/schema.py @@ -51,7 +51,8 @@ BigInteger = lambda: sqlalchemy.types.BigInteger() def from_migration_import(module_name, fromlist): - """Import a migration file and return the module + """ + Import a migration file and return the module :param module_name: name of migration module to import from (ex: 001_add_images_table) @@ -84,7 +85,6 @@ def from_migration_import(module_name, fromlist): images = define_images_table(meta) # Refer to images table - """ module_path = 'glance.registry.db.migrate_repo.versions.%s' % module_name module = __import__(module_path, globals(), locals(), fromlist, -1) diff --git a/glance/registry/db/migration.py b/glance/registry/db/migration.py index 366e52be00..f7f6d93605 100644 --- a/glance/registry/db/migration.py +++ b/glance/registry/db/migration.py @@ -33,7 +33,8 @@ logger = logging.getLogger('glance.registry.db.migration') def db_version(options): - """Return the database's current migration number + """ + Return the database's current migration number :param options: options dict :retval version number @@ -49,7 +50,8 @@ def db_version(options): def upgrade(options, version=None): - """Upgrade the database's current migration level + """ + Upgrade the database's current migration level :param options: options dict :param version: version to upgrade (defaults to latest) @@ -65,7 +67,8 @@ def upgrade(options, version=None): def downgrade(options, version): - """Downgrade the database's current migration level + """ + Downgrade the database's current migration level :param options: options dict :param version: version to downgrade to @@ -80,7 +83,8 @@ def downgrade(options, version): def version_control(options): - """Place a database under migration control + """ + Place a database under migration control :param options: options dict """ @@ -94,7 +98,8 @@ def version_control(options): def _version_control(options): - """Place a database under migration control + """ + Place a database under migration control :param options: options dict """ @@ -104,7 +109,8 @@ def _version_control(options): def db_sync(options, version=None): - """Place a database under migration control and perform an upgrade + """ + Place a database under migration control and perform an upgrade :param options: options dict :retval version number diff --git a/glance/registry/server.py b/glance/registry/server.py index 012268140f..cd5dbc897a 100644 --- a/glance/registry/server.py +++ b/glance/registry/server.py @@ -57,7 +57,8 @@ class Controller(object): db_api.configure_db(options) def index(self, req): - """Return a basic filtered list of public, non-deleted images + """ + Return a basic filtered list of public, non-deleted images :param req: the Request object coming from the wsgi layer :retval a mapping of the following form:: @@ -74,7 +75,6 @@ class Controller(object): 'container_format': , 'checksum': } - """ params = self._get_query_params(req) images = db_api.image_get_all_public(None, **params) @@ -88,7 +88,8 @@ class Controller(object): return dict(images=results) def detail(self, req): - """Return a filtered list of public, non-deleted images in detail + """ + Return a filtered list of public, non-deleted images in detail :param req: the Request object coming from the wsgi layer :retval a mapping of the following form:: @@ -97,7 +98,6 @@ class Controller(object): Where image_list is a sequence of mappings containing all image model fields. - """ params = self._get_query_params(req) images = db_api.image_get_all_public(None, **params) @@ -127,11 +127,11 @@ class Controller(object): return params def _get_filters(self, req): - """Return a dictionary of query param filters from the request + """ + Return a dictionary of query param filters from the request :param req: the Request object coming from the wsgi layer :retval a dict of key/value filters - """ filters = {} properties = {} @@ -208,7 +208,6 @@ class Controller(object): :param id: The opaque internal identifier for the image :retval Returns 200 if delete was successful, a fault if not. - """ context = None try: @@ -226,7 +225,6 @@ class Controller(object): :retval Returns the newly-created image information as a mapping, which will include the newly-created image's internal id in the 'id' field - """ image_data = body['image'] @@ -247,14 +245,14 @@ class Controller(object): return exc.HTTPBadRequest(msg) def update(self, req, id, body): - """Updates an existing image with the registry. + """ + Updates an existing image with the registry. :param req: wsgi Request object :param body: Dictionary of information about the image :param id: The opaque internal identifier for the image :retval Returns the updated image information as a mapping, - """ image_data = body['image'] diff --git a/glance/store/__init__.py b/glance/store/__init__.py index df674b3987..c444149ee0 100644 --- a/glance/store/__init__.py +++ b/glance/store/__init__.py @@ -116,7 +116,6 @@ def parse_uri_tokens(parsed_uri, example_url): 1) urlparse to split the tokens 2) use RE to split on @ and / 3) reassemble authurl - """ path = parsed_uri.path.lstrip('//') netloc = parsed_uri.netloc diff --git a/glance/store/filesystem.py b/glance/store/filesystem.py index e893fd0fa6..518d44d0b0 100644 --- a/glance/store/filesystem.py +++ b/glance/store/filesystem.py @@ -65,11 +65,11 @@ class ChunkedFile(object): class FilesystemBackend(glance.store.Backend): @classmethod def get(cls, parsed_uri, expected_size=None, options=None): - """ Filesystem-based backend + """ + Filesystem-based backend file:///path/to/file.tar.gz.0 """ - filepath = parsed_uri.path if not os.path.exists(filepath): raise exception.NotFound("Image file %s not found" % filepath) diff --git a/glance/store/http.py b/glance/store/http.py index b0ce9654f1..9ddb9ca746 100644 --- a/glance/store/http.py +++ b/glance/store/http.py @@ -25,10 +25,10 @@ class HTTPBackend(glance.store.Backend): @classmethod def get(cls, parsed_uri, expected_size, options=None, conn_class=None): - """Takes a parsed uri for an HTTP resource, fetches it, and yields the - data. """ - + Takes a parsed uri for an HTTP resource, fetches it, and + yields the data. + """ if conn_class: pass # use the conn_class passed in elif parsed_uri.scheme == "http": diff --git a/glance/store/swift.py b/glance/store/swift.py index db1e5d14f6..c972eed8c4 100644 --- a/glance/store/swift.py +++ b/glance/store/swift.py @@ -32,9 +32,8 @@ logger = logging.getLogger('glance.store.swift') class SwiftBackend(glance.store.Backend): - """ - An implementation of the swift backend adapter. - """ + """An implementation of the swift backend adapter.""" + EXAMPLE_URL = "swift://:@//" CHUNKSIZE = 65536 diff --git a/run_tests.py b/run_tests.py index 7284fb2388..57440f7c5b 100644 --- a/run_tests.py +++ b/run_tests.py @@ -38,7 +38,8 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -"""Unittest runner for glance +""" +Unittest runner for glance To run all test:: python run_tests.py @@ -211,7 +212,8 @@ class GlanceTestResult(result.TextTestResult): # NOTE(vish, tfukushima): copied from unittest with edit to add color def addError(self, test, err): - """Overrides normal addError to add support for errorClasses. + """ + Overrides normal addError to add support for errorClasses. If the exception is a registered class, the error will be added to the list for that class, not errors. """ diff --git a/tests/functional/test_bin_glance.py b/tests/functional/test_bin_glance.py index b9d5a0ea8f..acaed8fd7c 100644 --- a/tests/functional/test_bin_glance.py +++ b/tests/functional/test_bin_glance.py @@ -40,7 +40,6 @@ class TestBinGlance(functional.FunctionalTest): 3. Delete the image 4. Verify no longer in index """ - self.cleanup() self.start_servers() @@ -106,7 +105,6 @@ class TestBinGlance(functional.FunctionalTest): 5. Update the image's Name attribute 6. Verify the updated name is shown """ - self.cleanup() self.start_servers() @@ -192,7 +190,6 @@ class TestBinGlance(functional.FunctionalTest): 3. Verify the status of the image is displayed in the show output and is in status 'killed' """ - self.cleanup() # Start servers with a Swift backend and a bad auth URL @@ -253,7 +250,6 @@ class TestBinGlance(functional.FunctionalTest): 3. Verify no public images found 4. Run SQL against DB to verify no undeleted properties """ - self.cleanup() self.start_servers() diff --git a/tests/functional/test_curl_api.py b/tests/functional/test_curl_api.py index e17ef42a12..428cffa625 100644 --- a/tests/functional/test_curl_api.py +++ b/tests/functional/test_curl_api.py @@ -63,7 +63,6 @@ class TestCurlApi(functional.FunctionalTest): 11. PUT /images/1 - Add a previously deleted property. """ - self.cleanup() self.start_servers() @@ -382,7 +381,6 @@ class TestCurlApi(functional.FunctionalTest): 6. GET /images - Verify one public image """ - self.cleanup() self.start_servers() @@ -502,7 +500,6 @@ class TestCurlApi(functional.FunctionalTest): handled properly, and that usage of the Accept: header does content negotiation properly. """ - self.cleanup() self.start_servers() @@ -693,7 +690,6 @@ class TestCurlApi(functional.FunctionalTest): :see https://bugs.launchpad.net/glance/+bug/739433 """ - self.cleanup() self.start_servers() @@ -760,7 +756,6 @@ class TestCurlApi(functional.FunctionalTest): :see https://bugs.launchpad.net/glance/+bug/755912 """ - self.cleanup() self.start_servers() diff --git a/tests/functional/test_httplib2_api.py b/tests/functional/test_httplib2_api.py index af8cf75b81..450c5befa9 100644 --- a/tests/functional/test_httplib2_api.py +++ b/tests/functional/test_httplib2_api.py @@ -63,7 +63,6 @@ class TestApiHttplib2(functional.FunctionalTest): 11. PUT /images/1 - Add a previously deleted property. """ - self.cleanup() self.start_servers() diff --git a/tests/functional/test_logging.py b/tests/functional/test_logging.py index 4070df6471..4f5287ad11 100644 --- a/tests/functional/test_logging.py +++ b/tests/functional/test_logging.py @@ -33,7 +33,6 @@ class TestLogging(functional.FunctionalTest): Test logging output proper when verbose and debug is on. """ - self.cleanup() self.start_servers() @@ -60,7 +59,6 @@ class TestLogging(functional.FunctionalTest): Test logging output proper when verbose and debug is off. """ - self.cleanup() self.start_servers(debug=False, verbose=False) diff --git a/tests/functional/test_misc.py b/tests/functional/test_misc.py index dbcafc7235..afb96e50f0 100644 --- a/tests/functional/test_misc.py +++ b/tests/functional/test_misc.py @@ -39,7 +39,6 @@ class TestMiscellaneous(functional.FunctionalTest): We also fire the glance-upload tool against the API server and verify that glance-upload doesn't eat the exception either... """ - self.cleanup() self.start_servers() diff --git a/tests/stubs.py b/tests/stubs.py index f281a2473b..5c88e3664f 100644 --- a/tests/stubs.py +++ b/tests/stubs.py @@ -44,14 +44,14 @@ DEBUG = False def stub_out_http_backend(stubs): - """Stubs out the httplib.HTTPRequest.getresponse to return + """ + Stubs out the httplib.HTTPRequest.getresponse to return faked-out data instead of grabbing actual contents of a resource The stubbed getresponse() returns an iterator over the data "I am a teapot, short and stout\n" :param stubs: Set of stubout stubs - """ class FakeHTTPConnection(object): @@ -95,7 +95,6 @@ def stub_out_filesystem_backend(): //tmp/glance-tests/2 <-- file containing "chunk00000remainder" The stubbed service yields the data in the above files. - """ # Establish a clean faked filesystem with dummy images @@ -109,13 +108,13 @@ def stub_out_filesystem_backend(): def stub_out_s3_backend(stubs): - """ Stubs out the S3 Backend with fake data and calls. + """ + Stubs out the S3 Backend with fake data and calls. The stubbed s3 backend provides back an iterator over the data "" :param stubs: Set of stubout stubs - """ class FakeSwiftAuth(object): @@ -262,7 +261,8 @@ def stub_out_registry_and_store_server(stubs): def stub_out_registry_db_image_api(stubs): - """Stubs out the database set/fetch API calls for Registry + """ + Stubs out the database set/fetch API calls for Registry so the calls are routed to an in-memory dict. This helps us avoid having to manually clear or flush the SQLite database. @@ -270,6 +270,7 @@ def stub_out_registry_db_image_api(stubs): :param stubs: Set of stubout stubs """ + class FakeDatastore(object): FIXTURES = [ diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index 43f31b29ce..f3826959fd 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -50,9 +50,9 @@ class TestRegistryAPI(unittest.TestCase): self.stubs.UnsetAll() def test_get_root(self): - """Tests that the root registry API returns "index", + """ + Tests that the root registry API returns "index", which is a list of public images - """ fixture = {'id': 2, 'name': 'fake image #2', @@ -70,9 +70,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEquals(v, images[0][k]) def test_get_index(self): - """Tests that the /images registry API returns list of + """ + Tests that the /images registry API returns list of public images - """ fixture = {'id': 2, 'name': 'fake image #2', @@ -90,11 +90,10 @@ class TestRegistryAPI(unittest.TestCase): self.assertEquals(v, images[0][k]) def test_get_index_marker(self): - """Tests that the /images registry API returns list of - public images that conforms to a marker query param - """ - + Tests that the /images registry API returns list of + public images that conforms to a marker query param + """ time1 = datetime.datetime.utcnow() + datetime.timedelta(seconds=5) time2 = datetime.datetime.utcnow() @@ -148,9 +147,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEquals(int(images[2]['id']), 2) def test_get_index_limit(self): - """Tests that the /images registry API returns list of + """ + Tests that the /images registry API returns list of public images that conforms to a limit query param - """ extra_fixture = {'id': 3, 'status': 'active', @@ -186,27 +185,27 @@ class TestRegistryAPI(unittest.TestCase): self.assertTrue(int(images[0]['id']), 4) def test_get_index_limit_negative(self): - """Tests that the /images registry API returns list of + """ + Tests that the /images registry API returns list of public images that conforms to a limit query param - """ req = webob.Request.blank('/images?limit=-1') res = req.get_response(self.api) self.assertEquals(res.status_int, 400) def test_get_index_limit_non_int(self): - """Tests that the /images registry API returns list of + """ + Tests that the /images registry API returns list of public images that conforms to a limit query param - """ req = webob.Request.blank('/images?limit=a') res = req.get_response(self.api) self.assertEquals(res.status_int, 400) def test_get_index_limit_marker(self): - """Tests that the /images registry API returns list of + """ + Tests that the /images registry API returns list of public images that conforms to limit and marker query params - """ extra_fixture = {'id': 3, 'status': 'active', @@ -242,10 +241,10 @@ class TestRegistryAPI(unittest.TestCase): self.assertEqual(int(images[0]['id']), 2) def test_get_index_filter_name(self): - """Tests that the /images registry API returns list of + """ + Tests that the /images registry API returns list of public images that have a specific name. This is really a sanity check, filtering is tested more in-depth using /images/detail - """ fixture = {'id': 2, 'name': 'fake image #2', @@ -678,9 +677,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEquals(int(images[2]['id']), 2) def test_get_details(self): - """Tests that the /images/detail registry API returns + """ + Tests that the /images/detail registry API returns a mapping containing a list of detailed image information - """ fixture = {'id': 2, 'name': 'fake image #2', @@ -703,11 +702,11 @@ class TestRegistryAPI(unittest.TestCase): self.assertEquals(v, images[0][k]) def test_get_details_limit_marker(self): - """Tests that the /images/details registry API returns list of + """ + Tests that the /images/details registry API returns list of public images that conforms to limit and marker query params. This functionality is tested more thoroughly on /images, this is just a sanity check - """ extra_fixture = {'id': 3, 'status': 'active', @@ -743,9 +742,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEqual(int(images[0]['id']), 2) def test_get_details_filter_name(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a specific name - """ extra_fixture = {'id': 3, 'status': 'active', @@ -781,9 +780,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEqual('new name! #123', image['name']) def test_get_details_filter_status(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a specific status - """ extra_fixture = {'id': 3, 'status': 'saving', @@ -819,9 +818,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEqual('saving', image['status']) def test_get_details_filter_container_format(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a specific container_format - """ extra_fixture = {'id': 3, 'status': 'active', @@ -857,9 +856,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEqual('ovf', image['container_format']) def test_get_details_filter_disk_format(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a specific disk_format - """ extra_fixture = {'id': 3, 'status': 'active', @@ -895,9 +894,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertEqual('vhd', image['disk_format']) def test_get_details_filter_size_min(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a size greater than or equal to size_min - """ extra_fixture = {'id': 3, 'status': 'active', @@ -933,9 +932,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertTrue(image['size'] >= 19) def test_get_details_filter_size_max(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a size less than or equal to size_max - """ extra_fixture = {'id': 3, 'status': 'active', @@ -971,10 +970,10 @@ class TestRegistryAPI(unittest.TestCase): self.assertTrue(image['size'] <= 19) def test_get_details_filter_size_min_max(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a size less than or equal to size_max and greater than or equal to size_min - """ extra_fixture = {'id': 3, 'status': 'active', @@ -1021,9 +1020,9 @@ class TestRegistryAPI(unittest.TestCase): self.assertTrue(image['size'] <= 19 and image['size'] >= 18) def test_get_details_filter_property(self): - """Tests that the /images/detail registry API returns list of + """ + Tests that the /images/detail registry API returns list of public images that have a specific custom property - """ extra_fixture = {'id': 3, 'status': 'active', @@ -1164,8 +1163,10 @@ class TestRegistryAPI(unittest.TestCase): self.assertTrue('Invalid disk format' in res.body) def test_create_image_with_mismatched_formats(self): - """Tests that exception raised for bad matching disk and container - formats""" + """ + Tests that exception raised for bad matching disk and + container formats + """ fixture = {'name': 'fake public image #3', 'container_format': 'aki', 'disk_format': 'ari'} @@ -1221,8 +1222,10 @@ class TestRegistryAPI(unittest.TestCase): self.assertEquals(v, res_dict['image'][k]) def test_update_image_not_existing(self): - """Tests proper exception is raised if attempt to update non-existing - image""" + """ + Tests proper exception is raised if attempt to update + non-existing image + """ fixture = {'status': 'killed'} req = webob.Request.blank('/images/3') @@ -1278,8 +1281,10 @@ class TestRegistryAPI(unittest.TestCase): self.assertTrue('Invalid container format' in res.body) def test_update_image_with_mismatched_formats(self): - """Tests that exception raised for bad matching disk and container - formats""" + """ + Tests that exception raised for bad matching disk and + container formats + """ fixture = {'container_format': 'ari'} req = webob.Request.blank('/images/2') # Image 2 has disk format 'vhd' @@ -1323,9 +1328,10 @@ class TestRegistryAPI(unittest.TestCase): self.assertEquals(new_num_images, orig_num_images - 1) def test_delete_image_not_existing(self): - """Tests proper exception is raised if attempt to delete non-existing - image""" - + """ + Tests proper exception is raised if attempt to delete + non-existing image + """ req = webob.Request.blank('/images/3') req.method = 'DELETE' diff --git a/tests/unit/test_clients.py b/tests/unit/test_clients.py index 58be704ee2..d05bff677a 100644 --- a/tests/unit/test_clients.py +++ b/tests/unit/test_clients.py @@ -450,8 +450,10 @@ class TestRegistryClient(unittest.TestCase): self.assertEquals(images[0]['id'], 2) def test_get_image_index_by_name(self): - """Test correct set of public, name-filtered image returned. This - is just a sanity check, we test the details call more in-depth.""" + """ + Test correct set of public, name-filtered image returned. This + is just a sanity check, we test the details call more in-depth. + """ extra_fixture = {'id': 3, 'status': 'active', 'is_public': True, @@ -712,7 +714,6 @@ class TestRegistryClient(unittest.TestCase): def test_get_image_non_existing(self): """Tests that NotFound is raised when getting a non-existing image""" - self.assertRaises(exception.NotFound, self.client.get_image, 42) @@ -826,7 +827,6 @@ class TestRegistryClient(unittest.TestCase): def test_delete_image(self): """Tests that image metadata is deleted properly""" - # Grab the original number of images orig_num_images = len(self.client.get_images()) @@ -840,7 +840,6 @@ class TestRegistryClient(unittest.TestCase): def test_delete_image_not_existing(self): """Tests cannot delete non-existing image""" - self.assertRaises(exception.NotFound, self.client.delete_image, 3) @@ -890,7 +889,6 @@ class TestClient(unittest.TestCase): def test_get_image_not_existing(self): """Test retrieval of a non-existing image returns a 404""" - self.assertRaises(exception.NotFound, self.client.get_image, 3) @@ -1207,7 +1205,6 @@ class TestClient(unittest.TestCase): def test_get_image_non_existing(self): """Tests that NotFound is raised when getting a non-existing image""" - self.assertRaises(exception.NotFound, self.client.get_image, 42) @@ -1301,9 +1298,11 @@ class TestClient(unittest.TestCase): self.assertEquals('active', data['status']) def test_add_image_with_bad_iso_properties(self): - """Verify that ISO with invalid container format is rejected. + """ + Verify that ISO with invalid container format is rejected. Intended to exercise error path once rather than be exhaustive - set of mismatches""" + set of mismatches + """ fixture = {'name': 'fake public iso', 'is_public': True, 'disk_format': 'iso', @@ -1486,7 +1485,6 @@ class TestClient(unittest.TestCase): def test_delete_image(self): """Tests that image metadata is deleted properly""" - # Grab the original number of images orig_num_images = len(self.client.get_images()) @@ -1500,7 +1498,6 @@ class TestClient(unittest.TestCase): def test_delete_image_not_existing(self): """Tests cannot delete non-existing image""" - self.assertRaises(exception.NotFound, self.client.delete_image, 3) diff --git a/tools/install_venv.py b/tools/install_venv.py index 0234ce739c..442ed2d90e 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -77,7 +77,8 @@ def check_dependencies(): def create_virtualenv(venv=VENV): - """Creates the virtual environment and installs PIP only into the + """ + Creates the virtual environment and installs PIP only into the virtual environment """ print 'Creating venv...',