summaryrefslogtreecommitdiff
path: root/fs/tests
diff options
context:
space:
mode:
authorgcode@loowis.durge.org <gcode@loowis.durge.org@67cdc799-7952-0410-af00-57a81ceafa0f>2011-06-06 10:33:32 +0000
committergcode@loowis.durge.org <gcode@loowis.durge.org@67cdc799-7952-0410-af00-57a81ceafa0f>2011-06-06 10:33:32 +0000
commit6eb56b03d7e50603c685549346a698f8cd6cb628 (patch)
treefc2d187511e1cbc2b2c5a8857818d2a3359f6ebc /fs/tests
parentc2183f01de14e896a2ddc522f318b5d4fc9108f6 (diff)
downloadpyfilesystem-git-6eb56b03d7e50603c685549346a698f8cd6cb628.tar.gz
Unit tests fixup - CREATED is somethimes the second event rather than the first
Diffstat (limited to 'fs/tests')
-rw-r--r--fs/tests/test_watch.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/tests/test_watch.py b/fs/tests/test_watch.py
index 7cd3067..db8f831 100644
--- a/fs/tests/test_watch.py
+++ b/fs/tests/test_watch.py
@@ -53,14 +53,16 @@ class WatcherTestCases:
else:
time.sleep(2)#0.5)
- def assertEventOccurred(self,cls,path=None,**attrs):
- if not self.checkEventOccurred(cls,path,**attrs):
+ def assertEventOccurred(self,cls,path=None,event_list=None,**attrs):
+ if not self.checkEventOccurred(cls,path,event_list,**attrs):
args = (cls.__name__,path,attrs)
assert False, "Event did not occur: %s(%s,%s)" % args
- def checkEventOccurred(self,cls,path=None,**attrs):
+ def checkEventOccurred(self,cls,path=None,event_list=None,**attrs):
+ if event_list is None:
+ event_list = self._captured_events
self.waitForEvents()
- for event in self._captured_events:
+ for event in event_list:
if isinstance(event,cls):
if path is None or event.path == path:
for (k,v) in attrs.iteritems():
@@ -82,7 +84,7 @@ class WatcherTestCases:
self.watchfs.add_watcher(events2.append)
self.fs.makedir("test1")
self.assertEventOccurred(CREATED,"/test1")
- self.assertTrue(isinstance(events2[0],CREATED))
+ self.assertEventOccurred(CREATED,"/test1",event_list=events2)
def test_watch_readfile(self):
self.setupWatchers()