[conduit: 10/138] Take two. Just have a function that returns a new test case for a particular specialisation
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit: 10/138] Take two. Just have a function that returns a new test case for a particular specialisation
- Date: Thu, 21 May 2009 03:27:47 -0400 (EDT)
commit 8c39150ac796a49fc2cda78a95854ea8abdc2217
Author: John Carr <john carr unrouted co uk>
Date: Mon Apr 20 01:28:20 2009 -0700
Take two. Just have a function that returns a new test case for a particular specialisation
---
test/soup/__init__.py | 4 +++
test/soup/test_dataprovider.py | 59 ++++++++++++++++++---------------------
2 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/test/soup/__init__.py b/test/soup/__init__.py
index 041acfd..a2ee49c 100644
--- a/test/soup/__init__.py
+++ b/test/soup/__init__.py
@@ -1,4 +1,8 @@
+import os, sys
+cwd = os.path.dirname(__file__)
+sys.path.insert(0, os.path.abspath(os.path.join(cwd, '..', '..')))
+
import unittest
CHANGE_ADD = 1
diff --git a/test/soup/test_dataprovider.py b/test/soup/test_dataprovider.py
index d4cfae2..4c501d5 100644
--- a/test/soup/test_dataprovider.py
+++ b/test/soup/test_dataprovider.py
@@ -2,38 +2,33 @@ import unittest
import soup
-class DataproviderTest(soup.TestCase):
-
- def test_add(self):
- assert self.dataprovider != None
-
- def test_replace(self):
- pass
-
- def test_delete(self):
- pass
-
- def test_refresh(self):
- pass
-
- def test_finish(self):
- pass
-
- def test_get_num_items(self):
- pass
-
-def test_suite():
- collection = []
- bases = [DataproviderTest]
- for mod in soup.modules.all():
- name = mod.__class__.__name__
- attrs = {
- "dataprovider": mod
- }
- testcase = type(name, bases, attrs)
- suite = TestLoader().loadTestsFromTestCase(testcase)
- collection.append(suite)
- return unittest.TestSuite(collection)
+def make_testcase(dp):
+ class TestDataprovider(soup.TestCase):
+
+ dataprovider = dp
+
+ def test_add(self):
+ assert self.dataprovider != None
+
+ def test_replace(self):
+ pass
+
+ def test_delete(self):
+ pass
+
+ def test_refresh(self):
+ pass
+
+ def test_finish(self):
+ pass
+
+ def test_get_num_items(self):
+ pass
+
+ return TestDataprovider
+
+from soup.modules import folder
+TestDataproviderFolder = make_testcase(folder.FolderWrapper)
if __name__ == "__main__":
unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]