diff options
author | Robert Collins <robertc@robertcollins.net> | 2010-01-11 22:18:40 +1100 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2010-01-11 22:18:40 +1100 |
commit | 5a04cbba11f97a7db1057b602b0fd09d59e7b0ca (patch) | |
tree | bb59ddc0ecef3f086589b16fb9b74ca33a7a6e18 /lib/testresources/tests/test_resourced_test_case.py | |
parent | d188292a7cce5d6768add4aeb1195da752ba57b9 (diff) | |
parent | 853d1f7b23b0de1acc4f1762b8b9645a7afaa0d9 (diff) | |
download | testresources-5a04cbba11f97a7db1057b602b0fd09d59e7b0ca.tar.gz |
Make public reusable functions for setting up and tearing down resources of a test.
Diffstat (limited to 'lib/testresources/tests/test_resourced_test_case.py')
-rw-r--r-- | lib/testresources/tests/test_resourced_test_case.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/testresources/tests/test_resourced_test_case.py b/lib/testresources/tests/test_resourced_test_case.py index ee0a4ca..f613f39 100644 --- a/lib/testresources/tests/test_resourced_test_case.py +++ b/lib/testresources/tests/test_resourced_test_case.py @@ -67,7 +67,8 @@ class TestResourcedTestCase(testtools.TestCase): def testSetUpResourcesSingle(self): # setUpResources installs the resources listed in ResourcedTestCase. self.resourced_case.resources = [("foo", self.resource_manager)] - self.resourced_case.setUpResources() + testresources.setUpResources(self.resourced_case, + self.resourced_case.resources, None) self.assertEqual(self.resource, self.resourced_case.foo) def testSetUpResourcesMultiple(self): @@ -75,7 +76,8 @@ class TestResourcedTestCase(testtools.TestCase): self.resourced_case.resources = [ ('foo', self.resource_manager), ('bar', MockResource('bar_resource'))] - self.resourced_case.setUpResources() + testresources.setUpResources(self.resourced_case, + self.resourced_case.resources, None) self.assertEqual(self.resource, self.resourced_case.foo) self.assertEqual('bar_resource', self.resourced_case.bar) @@ -86,14 +88,16 @@ class TestResourcedTestCase(testtools.TestCase): # Give the 'foo' resource access to a 'bar' resource self.resource_manager.resources.append( ('bar', MockResource('bar_resource'))) - self.resourced_case.setUpResources() + testresources.setUpResources(self.resourced_case, + self.resourced_case.resources, None) self.assertEqual(resource, self.resourced_case.foo) self.assertEqual('bar_resource', self.resourced_case.foo.bar) def testSetUpUsesResource(self): # setUpResources records a use of each declared resource. self.resourced_case.resources = [("foo", self.resource_manager)] - self.resourced_case.setUpResources() + testresources.setUpResources(self.resourced_case, + self.resourced_case.resources, None) self.assertEqual(self.resource_manager._uses, 1) def testTearDownResourcesDeletesResourceAttributes(self): |