~jseutter/testresources/py3_without_distribute

« back to all changes in this revision

Viewing changes to lib/testresources/tests/test_resourced_test_case.py

  • Committer: Robert Collins
  • Date: 2009-07-13 08:22:13 UTC
  • Revision ID: robertc@robertcollins.net-20090713082213-5vfxvknu589mo64x
Really fix bug 284125 by using inspect to look up the TestResult being used and audit activity via the result object tests are being run with.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import testtools
22
22
import testresources
 
23
from testresources.tests import ResultWithResourceExtensions
23
24
 
24
25
 
25
26
def test_suite():
47
48
 
48
49
    def setUp(self):
49
50
        testtools.TestCase.setUp(self)
50
 
        self.resourced_case = testresources.ResourcedTestCase('run')
 
51
        class Example(testresources.ResourcedTestCase):
 
52
            def test_example(self):
 
53
                pass
 
54
        self.resourced_case = Example('test_example')
51
55
        self.resource = self.getUniqueString()
52
56
        self.resource_manager = MockResource(self.resource)
53
57
 
54
58
    def testDefaults(self):
55
59
        self.assertEqual(self.resourced_case.resources, [])
56
60
 
 
61
    def testResultPassedToResources(self):
 
62
        result = ResultWithResourceExtensions()
 
63
        self.resourced_case.resources = [("foo", self.resource_manager)]
 
64
        self.resourced_case.run(result)
 
65
        self.assertEqual(4, len(result._calls))
 
66
 
57
67
    def testSetUpResourcesSingle(self):
58
68
        # setUpResources installs the resources listed in ResourcedTestCase.
59
69
        self.resourced_case.resources = [("foo", self.resource_manager)]