[Zope3-checkins] CVS: Zope3/src/zope/fssync/tests - test_metadata.py:1.4

Guido van Rossum guido@python.org
Wed, 4 Jun 2003 15:00:39 -0400


Update of /cvs-repository/Zope3/src/zope/fssync/tests
In directory cvs.zope.org:/tmp/cvs-serv28088/tests

Modified Files:
	test_metadata.py 
Log Message:
Change flushkey() so that the Entries.xml file is never deleted.
Instead, an empty dict may be written to it.
(This is because deleting the file may delete the last *file* in a tree,
which makes it invisible when snarfed.)

=== Zope3/src/zope/fssync/tests/test_metadata.py 1.3 => 1.4 ===
--- Zope3/src/zope/fssync/tests/test_metadata.py:1.3	Wed May 28 10:40:04 2003
+++ Zope3/src/zope/fssync/tests/test_metadata.py	Wed Jun  4 15:00:38 2003
@@ -60,14 +60,15 @@
         md.flush()
         efile = join(dir, "@@Zope", "Entries.xml")
         self.assert_(isfile(efile))
-        f = open(efile)
-        data = f.read()
-        f.close()
+        data = self.readfile(efile)
         entries = loads(data)
         self.assertEqual(entries, {"foo": {"hello": "world"}})
         md.getentry(foo).clear()
         md.flush()
-        self.assert_(not exists(efile))
+        self.assert_(isfile(efile))
+        data = self.readfile(efile)
+        entries = loads(data)
+        self.assertEqual(entries, {})
 
 def test_suite():
     loader = unittest.TestLoader()