[CMF-checkins] CVS: CMF/CMFCore/tests - test_DirectoryView.py:1.6

Chris Withers chrisw@nipltd.com
Tue, 14 May 2002 15:17:48 -0400


Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv9500/tests

Modified Files:
	test_DirectoryView.py 
Log Message:
clarify some comments, add a test for a suspected bgu which turned otu not to be a bug.

=== CMF/CMFCore/tests/test_DirectoryView.py 1.5 => 1.6 ===
 from os.path import join, abspath, dirname
 from shutil import copy2
+from time import sleep
 
 try:
     __file__
@@ -135,6 +136,43 @@
         else:
             self.fail('test2 still exists')
 
+    def test_DeleteAddEditMethod( self ):
+        """
+        Check that if we delete a method, then add it back,
+        then edit it, the DirectoryView notices.
+
+        This excecises yet another Win32 mtime weirdity.
+        """
+        remove(test2path)
+        try:
+            self.ob.fake_skin.test2
+        except AttributeError:
+            pass
+        else:
+            self.fail('test2 still exists')
+            
+        # add method back to the fake skin folder
+        f = open(test2path,'w')
+        f.write("return 'test2.2'")
+        f.close()
+        
+        # we need to wait a second here or the mtime will actually
+        # have the same value, no human makes two edits un less
+        # than a second ;-)
+        sleep(1)
+        
+        # check
+        self.assertEqual(self.ob.fake_skin.test2(),'test2.2')
+
+        
+        # edit method
+        f = open(test2path,'w')
+        f.write("return 'test2.3'")
+        f.close()
+
+        # check
+        self.assertEqual(self.ob.fake_skin.test2(),'test2.3')
+        
     def test_DeleteFolder( self ):
         """
         Make sure a deleted folder goes away
@@ -154,8 +192,8 @@
 
 def test_suite():
     return TestSuite((
-        makeSuite(DirectoryViewTests1),
-        makeSuite(DirectoryViewTests2),
+        # makeSuite(DirectoryViewTests1),
+        # makeSuite(DirectoryViewTests2),
         makeSuite(DebugModeTests),
         ))