spurious reset before tests

Bug #503242 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testresources
Triaged
Wishlist
Unassigned

Bug Description

The following test script shows a spurious reset. It is due to the resource being always dirty, and getResource called from the test case. I'm not sure how to fix this, and it should be relatively cheap - if folk are overriding reset its because they can tune it.

import unittest

import testresources

resource_value = object()

class Resource(testresources.TestResource):

    def make(self, dependency_resources):

        print "Making resource"

        return resource_value

    def reset(self, old_resource, result=None):

        print "Resetting resource"

        assert old_resource is resource_value

        return resource_value

    def clean(self, resource):

        print "Cleaning resource"

        assert resource is resource_value

    # This doesn't seem to work.

    def isDirty(self):

        return True

some_resource = Resource()

class ResetTests(testresources.ResourcedTestCase):

    resources = [('foo', some_resource)]

    def test_one(self):

        print "Test one"

    def test_two(self):

        print "Test two"

def suite():

    result = testresources.TestLoader().loadTestsFromName(__name__)

    return result

if __name__ == '__main__':

    unittest.main(defaultTest='suite')

Changed in testresources:
status: New → Triaged
importance: Undecided → Wishlist
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.