[conduit: 17/138] Generate multiple dataprovider tests



commit 913a89ec4e899e6910fa88949ea54a31fef3f932
Author: John Carr <john carr unrouted co uk>
Date:   Mon Apr 20 07:46:07 2009 -0700

    Generate multiple dataprovider tests
---
 test/soup/modules/__init__.py  |    4 ++++
 test/soup/modules/folder.py    |    2 +-
 test/soup/modules/ipod.py      |    9 +++++++++
 test/soup/test_dataprovider.py |    2 +-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/test/soup/modules/__init__.py b/test/soup/modules/__init__.py
index 0b35930..f665d4b 100644
--- a/test/soup/modules/__init__.py
+++ b/test/soup/modules/__init__.py
@@ -7,6 +7,10 @@ class ModuleWrapper(object):
         self.conduit = conduit
         self.dp = self.create_dataprovider()
 
+    @classmethod
+    def name(cls):
+        return cls.__name__
+
     def get_num_items(self):
         count = 0
         try:
diff --git a/test/soup/modules/folder.py b/test/soup/modules/folder.py
index d53b844..dbfb930 100644
--- a/test/soup/modules/folder.py
+++ b/test/soup/modules/folder.py
@@ -2,7 +2,7 @@ import soup.modules
 
 import conduit.utils as Utils
 
-class FolderWrapper(soup.modules.ModuleWrapper):
+class Folder(soup.modules.ModuleWrapper):
 
     def create_dataprovider(self):
         dp = self.conduit.get_dataprovider("FolderTwoWay")
diff --git a/test/soup/modules/ipod.py b/test/soup/modules/ipod.py
new file mode 100644
index 0000000..b9b3371
--- /dev/null
+++ b/test/soup/modules/ipod.py
@@ -0,0 +1,9 @@
+
+import soup.modules
+
+class iPodCalendar(soup.modules.ModuleWrapper):
+
+    def create_dataprovider(self):
+        self.folder = Utils.new_tempdir()
+        return None
+
diff --git a/test/soup/test_dataprovider.py b/test/soup/test_dataprovider.py
index 876ddf3..a1580e1 100644
--- a/test/soup/test_dataprovider.py
+++ b/test/soup/test_dataprovider.py
@@ -28,7 +28,7 @@ def make_testcase(dp):
 # Generate TestCase objects for each dataprovider wrapper
 self = soup.get_module(__name__)
 for wrapper in soup.modules.get_all():
-    setattr(self, "TestDataprovider%s" % "Folder", make_testcase(wrapper))
+    setattr(self, "TestDataprovider%s" % wrapper.name(), make_testcase(wrapper))
 
 
 # Allow people to run the test case directly



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]