diff options
author | Free Ekanayaka <free@ekanayaka.io> | 2021-03-09 16:14:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-09 15:14:17 +0000 |
commit | b3f945064bf2e55f8796af000770711531dcac94 (patch) | |
tree | 790d5be424a11c88e2afe7aeda4326026ae25108 /testresources/tests/test_test_resource.py | |
parent | 04bf32c66d3339000517db6d55e1f8aaf91543f1 (diff) | |
download | testresources-git-master.tar.gz |
Add a TestResourceManager.id() API for letting test results report about a resource identity (#7)HEADmaster
Diffstat (limited to 'testresources/tests/test_test_resource.py')
-rw-r--r-- | testresources/tests/test_test_resource.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testresources/tests/test_test_resource.py b/testresources/tests/test_test_resource.py index 5ef7fc7..848ad51 100644 --- a/testresources/tests/test_test_resource.py +++ b/testresources/tests/test_test_resource.py @@ -435,6 +435,11 @@ class TestTestResource(testtools.TestCase): resource_manager.finishedWith(resource_manager._currentResource) self.assertEqual(expected, result._calls) + def testId(self): + resource_manager = testresources.TestResource() + self.assertEqual( + "testresources.TestResourceManager", resource_manager.id()) + class TestGenericResource(testtools.TestCase): @@ -495,6 +500,14 @@ class TestGenericResource(testtools.TestCase): self.assertTrue(mgr.isDirty()) mgr.finishedWith(resource) + def testId(self): + class Wrapped: + def setUp(self):pass + def tearDown(self):pass + mgr = testresources.GenericResource(Wrapped) + self.assertEqual( + "testresources.GenericResource[Wrapped]", mgr.id()) + class TestFixtureResource(testtools.TestCase): @@ -522,3 +535,11 @@ class TestFixtureResource(testtools.TestCase): mgr.finishedWith(resource) self.assertEqual( ['setUp', 'reset', 'cleanUp'], fixture.calls) + + def testId(self): + class MyLoggingFixture(LoggingFixture): + def __str__(self): + return "my-logger" + mgr = testresources.FixtureResource(MyLoggingFixture()) + self.assertEqual( + "testresources.FixtureResource[my-logger]", mgr.id()) |