Test scripts not using the right methods

Bug #1230028 reported by Zhongyue Luo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Zhongyue Luo

Bug Description

Below are some methods neutron would benefit in using

assertIsNone
assertIsInstance
assertIn
assertEqual
 - assertEquals is deprecated from py2.7

These methods reduce a redundant bool cast when using assertTrue and also enhances the readibility of the test scripts.

Tags: neutron-core
Zhongyue Luo (zyluo)
Changed in neutron:
assignee: nobody → Zhongyue Luo (zyluo)
Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
importance: Undecided → Medium
Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote : Re: [Bug 1230028] Re: Test scripts not using the right methods

i think there already a bug reported about this, and that review is
rejected https://review.openstack.org/#/c/44397/ with status=abandoned

On Wed, Sep 25, 2013 at 12:26 PM, yong sheng gong
<email address hidden>wrote:

> ** Changed in: neutron
> Importance: Undecided => Medium
>
> --
> You received this bug notification because you are subscribed to
> neutron.
> Matching subscriptions: neutron-bug
> https://bugs.launchpad.net/bugs/1230028
>
> Title:
> Test scripts not using the right methods
>
> Status in OpenStack Neutron (virtual network service):
> In Progress
>
> Bug description:
> Below are some methods neutron would benefit in using
>
> assertIsNone
> assertIsInstance
> assertIn
> assertEqual
> - assertEquals is deprecated from py2.7
>
> These methods reduce a redundant bool cast when using assertTrue and
> also enhances the readibility of the test scripts.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/neutron/+bug/1230028/+subscriptions
>

--
blog: zqfan.github.com
git: github.com/zqfan

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

Reviewed: https://review.openstack.org/45383
Committed: http://github.com/openstack/neutron/commit/844e3d9c527b42a1a052fb461ff3b6ac85122aa5
Submitter: Jenkins
Branch: master

commit 844e3d9c527b42a1a052fb461ff3b6ac85122aa5
Author: Zhongyue Luo <email address hidden>
Date: Fri Sep 6 15:18:49 2013 +0800

    Utilizes assertIsNone and assertIsNotNone

    Using assertTrue and the 'is' operator to test if an element is None
    is too python2.4. Our unit testing framework supports
    assertIsNone and assertIsNotNone which were created
    for these types of tests.

    Fixes bug #1230028

    Change-Id: Ia58d92c52d0aca9c22360dd44de19d4e5878ab13

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/45390
Committed: http://github.com/openstack/neutron/commit/f13c8d8e0de4428e412b46089c9cc67dafe71fdb
Submitter: Jenkins
Branch: master

commit f13c8d8e0de4428e412b46089c9cc67dafe71fdb
Author: Zhongyue Luo <email address hidden>
Date: Fri Sep 6 16:00:59 2013 +0800

    Utilize assertIsInstance

    Using assertTrue and the 'isinstance' function to test
    if an object is in an instance of some class is too python2.4.
    Our unit testing framework supports assertIsInstance which was created
    for these types of tests. Let's use assertIsInstance for these tests.

    Fixes bug #1230028

    Change-Id: Ia03c9f19a1c5e2aef3a6fe530515bd26339a7975

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

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

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

Reviewed: https://review.openstack.org/45386
Committed: http://github.com/openstack/neutron/commit/bdddb0bf1215fd5408e3a96ec4e3c73a1d34f2d1
Submitter: Jenkins
Branch: master

commit bdddb0bf1215fd5408e3a96ec4e3c73a1d34f2d1
Author: Zhongyue Luo <email address hidden>
Date: Fri Sep 6 15:29:38 2013 +0800

    Utilizes assertNotIn

    Using assertTrue and the 'not in' operator to test
    if an element is in a sequence is too python2.4.
    Our unit testing framework supports assertNotIn
    which was created for these types of tests.

    Fixes bug #1230028

    Change-Id: Ibaf6c73c514b9ad27f8f37eb3f1043e31dbfdcc1

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/48173
Committed: http://github.com/openstack/neutron/commit/bcbb029b1aacd64f8499db54a0e8f3e725727e07
Submitter: Jenkins
Branch: master

commit bcbb029b1aacd64f8499db54a0e8f3e725727e07
Author: Zhongyue Luo <email address hidden>
Date: Wed Sep 25 10:24:32 2013 +0800

    Utilizes assertIn

    Using assertTrue and the 'in' operator to test
    if an element is in a sequence is too python2.4.
    Our unit testing framework supports assertIn
    which was created for these types of tests.

    Fixes bug #1230028

    Change-Id: I8a9147fa9982644067ff45c73e116d88845e47e3

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/50519
Committed: http://github.com/openstack/neutron/commit/4114b91ca0d815bdc899d6b8d1e1be1b19795d66
Submitter: Jenkins
Branch: master

commit 4114b91ca0d815bdc899d6b8d1e1be1b19795d66
Author: Zhongyue Luo <email address hidden>
Date: Wed Oct 9 09:44:01 2013 +0800

    Utilizes assertIsNone and assertIsNotNone

    Using assertEqual/assertNotEqual to test if an element
    is or is not None is too python2.4.
    Our unit testing framework supports assertIsNone and assertIsNotNone
    which were created for these types of tests.

    Partial-bug: #1230028

    Change-Id: Ie0bddae642f7973ee8b0e00164415f8d87de387e

Changed in neutron:
milestone: none → icehouse-1
importance: Medium → Low
tags: added: neutron-core
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: icehouse-1 → 2014.1
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.