[conduit: 42/138] Don't use wrapped objects, adds a dep on ModuleManager and ends up taking 4x longer.
- From: John Carr <johncarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit: 42/138] Don't use wrapped objects, adds a dep on ModuleManager and ends up taking 4x longer.
- Date: Thu, 21 May 2009 03:30:28 -0400 (EDT)
commit 40d7f922b3aab4323ac4e3527c3b435b8ae04700
Author: John Carr <john carr unrouted co uk>
Date: Wed Apr 29 08:07:36 2009 -0700
Don't use wrapped objects, adds a dep on ModuleManager and ends up taking 4x longer.
---
test/soup/modules/folder.py | 5 ++-
test/soup/modules/ipod.py | 15 ++++---------
test/soup/test_dataprovider.py | 41 +++++++++++++++++++--------------------
3 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/test/soup/modules/folder.py b/test/soup/modules/folder.py
index 5aeddb8..da5b56c 100644
--- a/test/soup/modules/folder.py
+++ b/test/soup/modules/folder.py
@@ -1,6 +1,7 @@
import soup.modules
from soup.data.file import FileWrapper
+import conduit.modules.FileModule.FileModule as FileModule
import conduit.utils as Utils
@@ -9,8 +10,8 @@ class Folder(soup.modules.ModuleWrapper):
dataclass = FileWrapper
def create_dataprovider(self):
- dp = self.conduit.get_dataprovider("FolderTwoWay")
- dp.module.set_configuration({
+ dp = FileModule.FolderTwoWay()
+ dp.set_configuration({
"folder": Utils.new_tempdir(),
})
return dp
diff --git a/test/soup/modules/ipod.py b/test/soup/modules/ipod.py
index b1ae11e..f16a060 100644
--- a/test/soup/modules/ipod.py
+++ b/test/soup/modules/ipod.py
@@ -25,8 +25,7 @@ class iPodNote(soup.modules.ModuleWrapper):
def create_dataprovider(self):
self.folder = create_fake_ipod()
- ipod = iPodModule.IPodNoteTwoWay(self.folder, "")
- return self.conduit.wrap_dataprovider(ipod)
+ return iPodModule.IPodNoteTwoWay(self.folder, "")
class iPodContacts(soup.modules.ModuleWrapper):
@@ -35,8 +34,7 @@ class iPodContacts(soup.modules.ModuleWrapper):
def create_dataprovider(self):
self.folder = create_fake_ipod()
- ipod = iPodModule.IPodContactsTwoWay(self.folder, "")
- return self.conduit.wrap_dataprovider(ipod)
+ return iPodModule.IPodContactsTwoWay(self.folder, "")
class iPodCalendar(soup.modules.ModuleWrapper):
@@ -45,8 +43,7 @@ class iPodCalendar(soup.modules.ModuleWrapper):
def create_dataprovider(self):
self.folder = create_fake_ipod()
- ipod = iPodModule.IPodCalendarTwoWay(self.folder, "")
- return self.conduit.wrap_dataprovider(ipod)
+ return iPodModule.IPodCalendarTwoWay(self.folder, "")
class iPodPhoto(soup.modules.ModuleWrapper):
@@ -55,8 +52,7 @@ class iPodPhoto(soup.modules.ModuleWrapper):
def create_dataprovider(self):
self.folder = create_fake_ipod()
- ipod = iPodModule.IPodPhotoSink(self.folder, "")
- return self.conduit.wrap_dataprovider(ipod)
+ return iPodModule.IPodPhotoSink(self.folder, "")
#class iPodMusic(soup.modules.ModuleWrapper):
@@ -65,6 +61,5 @@ class iPodPhoto(soup.modules.ModuleWrapper):
# def create_dataprovider(self):
# self.folder = create_fake_ipod()
-# ipod = iPodModule.IPodMusicTwoWay(self.folder, "")
-# return self.conduit.wrap_dataprovider(ipod)
+# return iPodModule.IPodMusicTwoWay(self.folder, "")
diff --git a/test/soup/test_dataprovider.py b/test/soup/test_dataprovider.py
index 89859d0..013ac5a 100644
--- a/test/soup/test_dataprovider.py
+++ b/test/soup/test_dataprovider.py
@@ -10,7 +10,6 @@ def make_testcase(wrp):
def setUp(self):
super(TestDataprovider, self).setUp()
- self.setUpSync()
self.wrapper = self.wrapperclass(self)
self.dp = self.wrapper.dp
self.data = self.wrapper.dataclass()
@@ -20,46 +19,46 @@ def make_testcase(wrp):
def test_add(self):
""" Should be able to add items """
- self.dp.module.refresh()
+ self.dp.refresh()
for obj in self.data.iter_samples():
- self.dp.module.put(obj, False, None)
- self.dp.module.finish(False, False, False)
+ self.dp.put(obj, False, None)
+ self.dp.finish(False, False, False)
def test_replace(self):
""" Should be able to replace items """
obj = self.data.iter_samples().next()
- self.dp.module.refresh()
- rid = self.dp.module.put(obj, False, None)
- self.dp.module.finish(False, False, False)
+ self.dp.refresh()
+ rid = self.dp.put(obj, False, None)
+ self.dp.finish(False, False, False)
- self.dp.module.refresh()
- self.dp.module.put(obj, True, rid.get_UID())
- self.dp.module.finish(False, False, False)
+ self.dp.refresh()
+ self.dp.put(obj, True, rid.get_UID())
+ self.dp.finish(False, False, False)
def test_delete(self):
""" Should be able to delete items """
obj = self.data.iter_samples().next()
- self.dp.module.refresh()
- rid = self.dp.module.put(obj, False, None)
- self.dp.module.finish(False, False, False)
+ self.dp.refresh()
+ rid = self.dp.put(obj, False, None)
+ self.dp.finish(False, False, False)
- self.dp.module.refresh()
- self.dp.module.delete(rid.get_UID())
- self.dp.module.finish(False, False, False)
+ self.dp.refresh()
+ self.dp.delete(rid.get_UID())
+ self.dp.finish(False, False, False)
def test_refresh(self):
""" Refresh shouldnt throw exceptions """
- self.dp.module.refresh()
- self.dp.module.finish(False, False, False)
+ self.dp.refresh()
+ self.dp.finish(False, False, False)
def test_finish(self):
""" Should be able to call finish on cold """
- self.dp.module.finish(False, False, False)
+ self.dp.finish(False, False, False)
def test_get_num_items(self):
""" Number of items in a fresh dataprovider should be 0 """
- self.dp.module.refresh()
- assert self.dp.module.get_num_items() == 0
+ self.dp.refresh()
+ assert self.dp.get_num_items() == 0
return TestDataprovider
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]