Adapter to turn "servers" into "resources"

Bug #504083 reported by Jonathan Lange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testresources
Fix Released
Wishlist
Robert Collins

Bug Description

A lot of the "resources" that I need to use in tests have a common pattern. They are objects with setUp and tearDown methods, like the 'Server' objects used in Bazaar.

To spare me from writing a lot of boilerplate like this...

class SomeResource(TestResource):
    """A resource that provides a working couchdb instance."""

    def make(self, dependency_resources):
        result = DesktopCouchTestInstance(**dependency_resources)
        result.setUp()
        return result

    def clean(self, instance):
        instance.tearDown()

It would be nice if testresources had some sort of convenience method.

Related branches

Revision history for this message
Robert Collins (lifeless) wrote :

Perhaps:

server = DesktopCouchTestInstance(**dependency_resources)
resources = [('couchdb', GenericResource(server.setUp, server.tearDown))]

Changed in testresources:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Robert Collins (lifeless) wrote :

Fixed in 0.2.3

Changed in testresources:
assignee: nobody → Robert Collins (lifeless)
status: Triaged → Fix Released
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.