Refactoring required in cinder/tests/unit/test_migrations.py

Bug #1528989 reported by Sheel Rana
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
Sheel Rana

Bug Description

In cinder/tests/unit/test_migrations.py, we need to follow coding guidelines.

For ex,
In test_migrations.py, to use Boolean type constant is defined but for INTEGER and VARCHAR type they are used directly as shown below:
        BOOL_TYPE = sqlalchemy.types.BOOLEAN

        self.assertIsInstance(backups.c.deleted.type,
                              self.BOOL_TYPE)
        self.assertIsInstance(backups.c.id.type,
        sqlalchemy.types.VARCHAR)
        self.assertIsInstance(backups.c.volume_id.type,
        sqlalchemy.types.VARCHAR)

It must be updated as below to map coding guidelines

        BOOL_TYPE = sqlalchemy.types.BOOLEAN
        INTEGER_TYPE = sqlalchemy.types.INTEGER
        VARCHAR_TYPE = sqlalchemy.types.VARCHAR

        self.assertIsInstance(backups.c.deleted.type,
                              self.BOOL_TYPE)
        self.assertIsInstance(backups.c.id.type,
        self.VARCHAR_TYPE)
        self.assertIsInstance(backups.c.volume_id.type,
        self.VARCHAR_TYPE)

Reference to this raise:

During fixing https://bugs.launchpad.net/cinder/+bug/1518363,I came across this mismatch of coding guidelines.
Its suggested to merge this kind of refactoring in separate patch for better visibility of related code.

I am ready with the changes, will share patch soon..

Changed in cinder:
assignee: nobody → Sheel Rana (ranasheel2000)
description: updated
description: updated
Changed in cinder:
status: New → In Progress
description: updated
summary: - Refactoring required in cinder/tests/unit/test_migrations.py for better
- readability and for coding guidelines..
+ Refactoring required in cinder/tests/unit/test_migrations.py
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/264085

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/264085
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=253cab37e472d57efa996ee112de36124c8bb72a
Submitter: Jenkins
Branch: master

commit 253cab37e472d57efa996ee112de36124c8bb72a
Author: Sheel Rana <email address hidden>
Date: Wed Jan 6 14:47:19 2016 +0530

    Constant defined for sqlAlchemy VARCHAR & INTEGER

    sqlalchemy.types.VARCHAR and sqlalchemy.types.INTEGER are defined
    and used as VARCHAR_TYPE and INTEGER_TYPE respectively in
    cinder/tests/unit/test_migrations.py.

    Change-Id: I3ed83f270843e93d3d1f730d6eaf2320e8269743
    Closes-Bug: #1528989

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/cinder 8.0.0.0b2

This issue was fixed in the openstack/cinder 8.0.0.0b2 development milestone.

Changed in cinder:
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.