KombuStubs fixture in test_kombu is misleading and ugly

Bug #1192924 reported by Roman Podoliaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Low
Roman Podoliaka

Bug Description

Currently, KombuStubs is defined this way:

class KombuStubs:
    @staticmethod
    def setUp(self):
        if kombu:
            self.config(fake_rabbit=True)
            self.config(rpc_response_timeout=5)
            self.rpc = impl_kombu
            self.addCleanup(impl_kombu.cleanup)
        else:
            self.rpc = None

@staticmethod and usage of self variable is misleading and ugly. The original intention was to use this class as a fixture in various test cases. The problem is that this fixture requires a way to override config options for a test, which is done by config() method of test case instances. In order to use it, KombuStubs must have a reference to a test case instance.

We'd better pass this reference to KombuStubs __init__() method, rather than use a static method.

Tags: tests
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
assignee: nobody → Roman Podolyaka (rpodolyaka)
status: New → In Progress
Mark McLoughlin (markmc)
Changed in oslo:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/33804
Committed: http://github.com/openstack/oslo-incubator/commit/d8942ecc632efb1f960d0bb225703e15783dcb7c
Submitter: Jenkins
Branch: master

commit d8942ecc632efb1f960d0bb225703e15783dcb7c
Author: Roman Podolyaka <email address hidden>
Date: Thu Jun 20 14:15:35 2013 +0300

    Refactor KombuStubs fixture.

    Fixes bug 1192924.

    Change-Id: Ic6d9715c945e620da20b43310e8e8ba79296e4ad

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: havana-2 → 2013.2
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.